Skip to content

BUG: interpolate with ffill/bfill method, axis=1, multi-block #53898

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

Closed
3 tasks done
jbrockmendel opened this issue Jun 28, 2023 · 0 comments · Fixed by #53962
Closed
3 tasks done

BUG: interpolate with ffill/bfill method, axis=1, multi-block #53898

jbrockmendel opened this issue Jun 28, 2023 · 0 comments · Fixed by #53962
Labels
Bug Missing-data np.nan, pd.NaT, pd.NA, dropna, isnull, interpolate Multi-Block Issues caused by the presence of multiple Blocks

Comments

@jbrockmendel
Copy link
Member

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)
<stdin>: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()

@jbrockmendel jbrockmendel added Bug Needs Triage Issue that has not been reviewed by a pandas team member labels Jun 28, 2023
@lithomas1 lithomas1 added Missing-data np.nan, pd.NaT, pd.NA, dropna, isnull, interpolate Multi-Block Issues caused by the presence of multiple Blocks and removed Needs Triage Issue that has not been reviewed by a pandas team member labels Jun 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Missing-data np.nan, pd.NaT, pd.NA, dropna, isnull, interpolate Multi-Block Issues caused by the presence of multiple Blocks
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants