Skip to content

DOC: .bfill() (#46631) #46642

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

Merged
merged 2 commits into from
Apr 5, 2022
Merged

DOC: .bfill() (#46631) #46642

merged 2 commits into from
Apr 5, 2022

Conversation

kwhkim
Copy link
Contributor

@kwhkim kwhkim commented Apr 5, 2022

@MarcoGorelli
Copy link
Member

Thanks @kwhkim - wouldn't this be equivalent of df.reindex(df.index[::-1]).ffill().reindex(df.index)?

In [7]: df.reindex(df.index[::-1]).ffill().reindex(df.index)
Out[7]: 
                   A
2013-08-01 -1.571201
2013-08-02  2.061834
2013-08-05 -0.831290
2013-08-06  1.448895
2013-08-07  1.448895
2013-08-08 -0.258116

In [8]: df.bfill()
Out[8]: 
                   A
2013-08-01 -1.571201
2013-08-02  2.061834
2013-08-05 -0.831290
2013-08-06  1.448895
2013-08-07  1.448895
2013-08-08 -0.258116

@kwhkim
Copy link
Contributor Author

kwhkim commented Apr 5, 2022

Yes, I just meant that the contents are the same. Would it be better to be df.reindex(df.index[::-1]).ffill().reindex(df.index)? The context is talking about df.reindex(df.index[::-1]).ffill() so I think it might be better to change df.bfill() to df.bfill().reindex(df.index[::-1]) considering the paragraph it's in.

@MarcoGorelli
Copy link
Member

I think just put

df.bfill()

without the comment and it'll be fine

cc @jreback , who originally wrote this example

@jreback jreback added Docs Missing-data np.nan, pd.NaT, pd.NA, dropna, isnull, interpolate labels Apr 5, 2022
@jreback jreback added this to the 1.5 milestone Apr 5, 2022
@jreback jreback merged commit 103c92e into pandas-dev:main Apr 5, 2022
@jreback
Copy link
Contributor

jreback commented Apr 5, 2022

thanks @kwhkim

yehoshuadimarsky pushed a commit to yehoshuadimarsky/pandas that referenced this pull request Jul 13, 2022
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.

DOC: simply method='bfill'?
3 participants