-
-
Notifications
You must be signed in to change notification settings - Fork 19.1k
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 | ||
|
||
""" | ||
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 | ||
|
||
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