Skip to content

Axis behaviour not consistent for df.interpolate for pad with limit_area passed. #41813

Closed
@mwaddoups

Description

@mwaddoups

The axis along which interpolation is performed is different for different methods in interpolate.

For example

df = pd.DataFrame(np.array([
    [1, 2, 3],
    [5, np.nan, np.nan],
    [3, np.nan, 4],
]))

print(df.interpolate(method='pad', axis='index'))

print(df.interpolate(method='pad', axis='index', limit_area='inside'))

returns

     0    1    2
0  1.0  2.0  3.0
1  5.0  2.0  6.0
2  3.0  2.0  4.0

     0    1    2
0  1.0  2.0  3.0
1  5.0  5.0  6.0
2  3.0  3.0  4.0

Clearly with limit_area set the interpolation happens on the wrong axis.

Not contributed before but happy to have a go at this one?

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugMissing-datanp.nan, pd.NaT, pd.NA, dropna, isnull, interpolate

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions