Skip to content

Commit b4ad229

Browse files
committed
adjust after merge
1 parent a437392 commit b4ad229

File tree

5 files changed

+34
-9
lines changed

5 files changed

+34
-9
lines changed

pandas/core/frame.py

+15
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@
7777
Appender,
7878
Substitution,
7979
deprecate_kwarg,
80+
deprecate_nonkeyword_arguments,
8081
doc,
8182
rewrite_axis_style_signature,
8283
)
@@ -10621,6 +10622,20 @@ def values(self) -> np.ndarray:
1062110622
self._consolidate_inplace()
1062210623
return self._mgr.as_array(transpose=True)
1062310624

10625+
@deprecate_nonkeyword_arguments(
10626+
version=None, allowed_args=["self", "lower", "upper"]
10627+
)
10628+
def clip(
10629+
self: DataFrame,
10630+
lower=None,
10631+
upper=None,
10632+
axis: Axis | None = None,
10633+
inplace: bool = False,
10634+
*args,
10635+
**kwargs,
10636+
) -> DataFrame | None:
10637+
return super().clip(lower, upper, axis, inplace, *args, **kwargs)
10638+
1062410639
@property
1062510640
def _values(self) -> np.ndarray:
1062610641
"""internal implementation"""

pandas/core/generic.py

-5
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@
6161
InvalidIndexError,
6262
)
6363
from pandas.util._decorators import (
64-
deprecate_nonkeyword_arguments,
6564
doc,
6665
rewrite_axis_style_signature,
6766
)
@@ -7470,10 +7469,6 @@ def clip(
74707469
) -> FrameOrSeries | None:
74717470
...
74727471

7473-
@deprecate_nonkeyword_arguments(
7474-
version="2.0", allowed_args=["self", "lower", "upper"]
7475-
)
7476-
@final
74777472
def clip(
74787473
self: FrameOrSeries,
74797474
lower=None,

pandas/core/series.py

+15
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
from pandas.util._decorators import (
5252
Appender,
5353
Substitution,
54+
deprecate_nonkeyword_arguments,
5455
doc,
5556
)
5657
from pandas.util._validators import (
@@ -5256,6 +5257,20 @@ def to_period(self, freq=None, copy=True) -> Series:
52565257
self, method="to_period"
52575258
)
52585259

5260+
@deprecate_nonkeyword_arguments(
5261+
version=None, allowed_args=["self", "lower", "upper"]
5262+
)
5263+
def clip(
5264+
self: Series,
5265+
lower=None,
5266+
upper=None,
5267+
axis: Axis | None = None,
5268+
inplace: bool = False,
5269+
*args,
5270+
**kwargs,
5271+
) -> Series | None:
5272+
return super().clip(lower, upper, axis, inplace, *args, **kwargs)
5273+
52595274
# ----------------------------------------------------------------------
52605275
# Add index
52615276
_AXIS_ORDERS = ["index"]

pandas/tests/frame/methods/test_clip.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -171,8 +171,8 @@ def test_clip_pos_args_deprecation(self):
171171
# https://github.com/pandas-dev/pandas/issues/41485
172172
df = DataFrame({"a": [1, 2, 3]})
173173
msg = (
174-
r"Starting with Pandas version 2\.0 all arguments of clip except "
175-
r"for the arguments 'self', 'lower' and 'upper' will be keyword-only"
174+
r"In a future version of pandas all arguments of DataFrame.clip except "
175+
r"for the arguments 'lower' and 'upper' will be keyword-only"
176176
)
177177
with tm.assert_produces_warning(FutureWarning, match=msg):
178178
df.clip(0, 1, 0)

pandas/tests/series/methods/test_clip.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,8 @@ def test_clip_pos_args_deprecation(self):
132132
# https://github.com/pandas-dev/pandas/issues/41485
133133
ser = Series([1, 2, 3])
134134
msg = (
135-
r"Starting with Pandas version 2\.0 all arguments of clip except "
136-
r"for the arguments 'self', 'lower' and 'upper' will be keyword-only"
135+
r"In a future version of pandas all arguments of Series.clip except "
136+
r"for the arguments 'lower' and 'upper' will be keyword-only"
137137
)
138138
with tm.assert_produces_warning(FutureWarning, match=msg):
139139
ser.clip(0, 1, 0)

0 commit comments

Comments
 (0)