Pandas Interpolate Does not Handle Empty Values at Front of Series · Issue #10420 · pandas-dev/pandas (original) (raw)

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