Skip to content

Commit 94777aa

Browse files
committed
DEPR: deprecating series asof GH10343
1 parent c74820e commit 94777aa

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed

doc/source/api.rst

-1
Original file line numberDiff line numberDiff line change
@@ -449,7 +449,6 @@ Time series-related
449449
:toctree: generated/
450450

451451
Series.asfreq
452-
Series.asof
453452
Series.shift
454453
Series.first_valid_index
455454
Series.last_valid_index

doc/source/whatsnew/v0.17.0.txt

+5
Original file line numberDiff line numberDiff line change
@@ -521,6 +521,11 @@ Deprecations
521521

522522
- ``Categorical.name`` was deprecated to make ``Categorical`` more ``numpy.ndarray`` like. Use ``Series(cat, name="whatever")`` instead (:issue:`10482`).
523523

524+
- :meth:`Series.asof` is deprecated. Please use :meth:`Series.reindex(where, method='ffill')`
525+
instead. This method does not drop missing values in the original series.
526+
527+
So `Series.asof(where)` is equivalent to `Series.dropna().reindex(where, method='ffill')`.
528+
524529
.. _whatsnew_0170.prior_deprecations:
525530

526531
Removal of prior version deprecations/changes

pandas/core/series.py

+12
Original file line numberDiff line numberDiff line change
@@ -2452,6 +2452,11 @@ def last_valid_index(self):
24522452

24532453
def asof(self, where):
24542454
"""
2455+
DEPRECATED. Please use :meth:`Series.reindex` instead.
2456+
2457+
So a `Series.asof(where)` can be replaced by
2458+
`Series.dropna().reindex(where, method='ffill')`.
2459+
24552460
Return last good (non-NaN) value in TimeSeries if value is NaN for
24562461
requested date.
24572462
@@ -2468,7 +2473,14 @@ def asof(self, where):
24682473
Returns
24692474
-------
24702475
value or NaN
2476+
2477+
See Also
2478+
--------
2479+
pandas.Series.reindex
2480+
24712481
"""
2482+
warnings.warn("`Series.asof` is deprecated, use "
2483+
"`Series.reindex` instead.", FutureWarning)
24722484
if isinstance(where, compat.string_types):
24732485
where = datetools.to_datetime(where)
24742486

0 commit comments

Comments
 (0)