Skip to content

Pandas Interpolate Does not Handle Empty Values at Front of Series #10420

Closed
@cancan101

Description

@cancan101

This code means the interpolator won't handle extrapolating to the front of the Series even though the underlying implementations may have no problem with the extrapolation.

See for example UnivariateSpline whose default behavior is extrapolation.

Interpolation works fine at the end of the Series.

For example:

s = pd.Series([1, 2, 3, 4, np.nan, 6, np.nan])
s.interpolate(method='spline', order=1)
0    1
1    2
2    3
3    4
4    5
5    6
6    7
dtype: float64

but:

s = pd.Series([np.nan, 2, 3, 4, np.nan, 6, 7])
s.interpolate(method='spline', order=1)
0   NaN
1     2
2     3
3     4
4     5
5     6
6     7
dtype: float64

Metadata

Metadata

Assignees

No one assigned

    Labels

    API DesignMissing-datanp.nan, pd.NaT, pd.NA, dropna, isnull, interpolateNumeric OperationsArithmetic, Comparison, and Logical operations

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions