You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This change adds a new keyword argument for specifying the direction in
which an interpolation limit ought to be applied.
The default, when ``limit_direction`` is 'forward', fills in NaN values
after non-NaNs, for up to ``limit`` consecutive fills. No interpolated
values are used to fill NaNs before non-NaNs. This matches the current
behavior for interpolate.
If ``limit_direction`` is 'backward', the interpolation will fill in up
to ``limit`` NaN values *before* non-NaN values, for up to ``limit``
consecutive fills. No interpolated values will be used to fill NaNs
after non-NaNs.
If ``limit_direction`` is another value, the interpolation will fill in
NaN values both before and after non-NaNs, up to ``limit`` in each
direction, so that up to ``2 * limit`` consecutive values will be filled
in around each non-NaN segment.
Copy file name to clipboardExpand all lines: doc/source/whatsnew/v0.17.0.txt
+6
Original file line number
Diff line number
Diff line change
@@ -55,6 +55,12 @@ New features
55
55
- SQL io functions now accept a SQLAlchemy connectable. (:issue:`7877`)
56
56
- Enable writing complex values to HDF stores when using table format (:issue:`10447`)
57
57
- Enable reading gzip compressed files via URL, either by explicitly setting the compression parameter or by inferring from the presence of the HTTP Content-Encoding header in the response (:issue:`8685`)
58
+
- Add a ``limit_direction`` keyword argument that works with ``limit`` to enable ``interpolate`` to fill ``NaN`` values forward, backward, or both (:issue:`9218` and :issue:`10420`)
59
+
60
+
.. ipython:: python
61
+
62
+
ser = pd.Series([np.nan, np.nan, 5, np.nan, np.nan, np.nan, 13])
0 commit comments