Skip to content

Commit d83246c

Browse files
committed
requested doc changes
1 parent 80d67b7 commit d83246c

File tree

4 files changed

+12
-6
lines changed

4 files changed

+12
-6
lines changed

doc/source/missing_data.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -458,6 +458,8 @@ at the new values.
458458
.. _documentation: http://docs.scipy.org/doc/scipy/reference/interpolate.html#univariate-interpolation
459459
.. _guide: http://docs.scipy.org/doc/scipy/reference/tutorial/interpolate.html
460460

461+
.. _missing_data.interp_limits:
462+
461463
Interpolation Limits
462464
^^^^^^^^^^^^^^^^^^^^
463465

doc/source/whatsnew/v0.21.0.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ New features
2424
<https://www.python.org/dev/peps/pep-0519/>`_ on most readers and writers (:issue:`13823`)
2525
- Added `__fspath__` method to :class`:pandas.HDFStore`, :class:`pandas.ExcelFile`,
2626
and :class:`pandas.ExcelWriter` to work properly with the file system path protocol (:issue:`13823`)
27-
- Added `limit_area` parameter to `DataFrame.interpolate()` method allowing further control of which NaNs are replaced (:issue:`16284`)
27+
- Added `limit_area` parameter to `DataFrame.interpolate()` method allowing further control of which NaNs are replaced.
28+
Use `limit-area='inside'` to fill only NaNs surrounded by valid values or use `limit-area='outside'` to fill only NaNs outside the existing valid values while preserving those inside. (:issue:`16284`)
29+
Full documentation and examples are :ref:`here <missing_data.interp_limits>`.
2830

2931
.. _whatsnew_0210.enhancements.other:
3032

pandas/core/generic.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3884,11 +3884,13 @@ def replace(self, to_replace=None, value=None, inplace=False, limit=None,
38843884
Maximum number of consecutive NaNs to fill. Must be greater than 0.
38853885
limit_direction : {'forward', 'backward', 'both'}, default 'forward'
38863886
Consecutive NaNs will be filled in this direction.
3887+
38873888
.. versionadded:: 0.17.0
3889+
38883890
limit_area : {'inside', 'outside'}, default None
3891+
* None: (default) no fill restriction
38893892
* 'inside' Only fill NaNs surrounded by valid values (interpolate).
38903893
* 'outside' Only fill NaNs outside valid values (extrapolate).
3891-
* None: default fill inside and outside
38923894
.. versionadded:: 0.21.0
38933895
38943896
inplace : bool, default False

pandas/core/missing.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -152,15 +152,15 @@ def _interp_limit(invalid, fw_limit, bw_limit):
152152
valid_limit_directions = ['forward', 'backward', 'both']
153153
limit_direction = limit_direction.lower()
154154
if limit_direction not in valid_limit_directions:
155-
raise ValueError('Invalid limit_direction: expecting one of %r, got '
156-
'%r.' % (valid_limit_directions, limit_direction))
155+
raise ValueError('Invalid limit_direction: expecting one of {}, got '
156+
'{}.'.format(valid_limit_directions, limit_direction))
157157

158158
if limit_area is not None:
159159
valid_limit_areas = ['inside', 'outside']
160160
limit_area = limit_area.lower()
161161
if limit_area not in valid_limit_areas:
162-
raise ValueError('Invalid limit_area: expecting one of %r, got %r.'
163-
% (valid_limit_areas, limit_area))
162+
raise ValueError('Invalid limit_area: expecting one of {}, got '
163+
'{}.'.format(valid_limit_areas, limit_area))
164164

165165
# default limit is unlimited GH #16282
166166
if limit is None:

0 commit comments

Comments
 (0)