BUG: interpolate with ffill/bfill method, axis=1, multi-block · Issue #53898 · pandas-dev/pandas (original) (raw)
Pandas version checks
- I have checked that this issue has not already been reported.
- I have confirmed this bug exists on the latest version of pandas.
- I have confirmed this bug exists on the main branch of pandas.
Reproducible Example
import numpy as np import pandas as pd
df = pd.DataFrame(np.random.randn(3, 3), columns=["A", "B", "C"]) df["D"] = np.nan df["E"] = 1.0
df.interpolate(method="ffill", axis=1) :1: FutureWarning: DataFrame.interpolate with method=ffill is deprecated and will raise in a future version. Use obj.ffill() or obj.bfill() instead. A B C D E 0 -0.656239 0.898067 0.842284 NaN 1.0 1 -0.914892 -0.018121 -0.382542 NaN 1.0 2 1.818251 -0.148962 0.550328 NaN 1.0
Issue Description
This operates block-by-block and fails to fill across blocks.
I'd expect this to behave like df.T.interpolate(method="ffill").T
That is what we do in NDFrame._pad_or_backfill. Note that it doesn't play nicely with the "downcast" keyword.
This value for "method" is deprecated, but still might be worth doing something about in the interim.
Expected Behavior
NA
Installed Versions
Replace this line with the output of pd.show_versions()