-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
DEPR: Series.ptp() #21614
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DEPR: Series.ptp() #21614
Changes from 3 commits
6559bbf
d643966
9e72362
424a670
0028c7c
c25ea13
2932a99
446c884
cede496
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8871,8 +8871,15 @@ def _add_series_only_operations(cls): | |
axis_descr, name, name2 = _doc_parms(cls) | ||
|
||
def nanptp(values, axis=0, skipna=True): | ||
""" | ||
.. deprecated:: 0.24.0 | ||
Use numpy.ptp instead | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am not sure this is the right format for the doc-str, cc @jorisvandenbossche There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks - will wait for confirmation on right format from @jorisvandenbossche Based on the other deprecation PRs I checked, this seemed to be the expected format - for other messages I had noted earlier I got Travis failures (example below from different PR submitted) Check for deprecated messages without sphinx directive
pandas/core/indexes/multi.py: DEPRECATED: to_hierarchical will be removed in a future version.
Check for deprecated messages without sphinx directive DONE
...
The command "ci/lint.sh" exited with 1. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, this is the correct format. But, shouldn't this rather be in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Did a quick check, and indeed adding the deprecation message does not update the actual docstring of |
||
""" | ||
nmax = nanops.nanmax(values, axis, skipna) | ||
nmin = nanops.nanmin(values, axis, skipna) | ||
warnings.warn("Method .ptp is deprecated and will be removed " | ||
"in a future version. Use numpy.ptp instead.", | ||
FutureWarning, stacklevel=4) | ||
return nmax - nmin | ||
|
||
cls.ptp = _make_stat_function( | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1381,8 +1381,12 @@ def test_ptp(self): | |
ser = Series(arr) | ||
assert np.ptp(ser) == np.ptp(arr) | ||
|
||
# GH11163 | ||
s = Series([3, 5, np.nan, -3, 10]) | ||
|
||
# GH21614 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. make this another method. you need to catch any warnings for calling |
||
with tm.assert_produces_warning(FutureWarning): | ||
s.ptp() | ||
# GH11163 | ||
assert s.ptp() == 13 | ||
assert pd.isna(s.ptp(skipna=False)) | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can put a reference to
numpy.ptp
as wellThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done - updated for all comments Thanks