Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DOC: NDFrame fillna method add use case #39109

Merged
merged 4 commits into from
Jan 25, 2021
Merged

Conversation

aniaan
Copy link
Contributor

@aniaan aniaan commented Jan 11, 2021

cc @MarcoGorelli

@MarcoGorelli MarcoGorelli self-requested a review January 11, 2021 18:16
@jreback jreback added Docs Missing-data np.nan, pd.NaT, pd.NA, dropna, isnull, interpolate labels Jan 12, 2021
@jreback jreback added this to the 1.3 milestone Jan 12, 2021
@@ -6362,6 +6360,16 @@ def fillna(
1 3.0 4.0 NaN 1
2 NaN 1.0 NaN 5
3 NaN 3.0 NaN 4

Replace with a DataFrame with the same column name
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this could be clarified - replacement happens along same column names and same indices. Maybe the example df2 could also have a column with a different name, such as columns=list("ABCE") so it's clear that replacement only happens for the columns they have in common

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are correct, now corrected

@@ -148,7 +148,6 @@
you to specify a location to update with some value.""",
}


Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why change this? could unrelated changes be reverted please?

@@ -6362,6 +6362,16 @@ def fillna(
1 3.0 4.0 NaN 1
2 NaN 1.0 NaN 5
3 NaN 3.0 NaN 4

Replacement happens along same column names and same indices
Copy link
Member

@MarcoGorelli MarcoGorelli Jan 17, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you write this as "When filling using a DataFrame, replacement happens along the same column names and same indices:" (may need to split it across two lines). Other than that, looks good, thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It has been updated, please take a look

Copy link
Contributor

@jreback jreback left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm. @MarcoGorelli merge when satisfied

When filling using a DataFrame, replacement happens along
the same column names and same indices

>>> df2 = pd.DataFrame(np.zeros((5, 5)), columns=list("ABCED"))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could df2 have columns "ABCE", so it's clear that there will be no replacement in column D (which is absent from df2)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed

@jreback jreback merged commit 62c7dd6 into pandas-dev:master Jan 25, 2021
@jreback
Copy link
Contributor

jreback commented Jan 25, 2021

thanks @BEANNAN

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Docs Missing-data np.nan, pd.NaT, pd.NA, dropna, isnull, interpolate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Passing DataFrame of values to fillna()
3 participants