Skip to content

Commit 3f6e43b

Browse files
committed
fixup after merge
1 parent 0301254 commit 3f6e43b

File tree

5 files changed

+52
-7
lines changed

5 files changed

+52
-7
lines changed

pandas/core/frame.py

+24
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
)
@@ -10626,6 +10627,29 @@ def _values(self) -> np.ndarray:
1062610627
"""internal implementation"""
1062710628
return self.values
1062810629

10630+
@deprecate_nonkeyword_arguments(version=None, allowed_args=["self", "method"])
10631+
def interpolate(
10632+
self: DataFrame,
10633+
method: str = "linear",
10634+
axis: Axis = 0,
10635+
limit: int | None = None,
10636+
inplace: bool = False,
10637+
limit_direction: str | None = None,
10638+
limit_area: str | None = None,
10639+
downcast: str | None = None,
10640+
**kwargs,
10641+
) -> DataFrame | None:
10642+
return super().interpolate(
10643+
method,
10644+
axis,
10645+
limit,
10646+
inplace,
10647+
limit_direction,
10648+
limit_area,
10649+
downcast,
10650+
**kwargs,
10651+
)
10652+
1062910653

1063010654
DataFrame._add_numeric_operations()
1063110655

pandas/core/generic.py

-3
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
)
@@ -6697,8 +6696,6 @@ def replace(
66976696
else:
66986697
return result.__finalize__(self, method="replace")
66996698

6700-
@deprecate_nonkeyword_arguments(version="2.0", allowed_args=["self", "method"])
6701-
@final
67026699
def interpolate(
67036700
self: FrameOrSeries,
67046701
method: str = "linear",

pandas/core/series.py

+24
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,29 @@ def to_period(self, freq=None, copy=True) -> Series:
52565257
self, method="to_period"
52575258
)
52585259

5260+
@deprecate_nonkeyword_arguments(version=None, allowed_args=["self", "method"])
5261+
def interpolate(
5262+
self: Series,
5263+
method: str = "linear",
5264+
axis: Axis = 0,
5265+
limit: int | None = None,
5266+
inplace: bool = False,
5267+
limit_direction: str | None = None,
5268+
limit_area: str | None = None,
5269+
downcast: str | None = None,
5270+
**kwargs,
5271+
) -> Series | None:
5272+
return super().interpolate(
5273+
method,
5274+
axis,
5275+
limit,
5276+
inplace,
5277+
limit_direction,
5278+
limit_area,
5279+
downcast,
5280+
**kwargs,
5281+
)
5282+
52595283
# ----------------------------------------------------------------------
52605284
# Add index
52615285
_AXIS_ORDERS = ["index"]

pandas/tests/frame/methods/test_interpolate.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -347,8 +347,8 @@ def test_interpolate_pos_args_deprecation(self):
347347
# https://github.com/pandas-dev/pandas/issues/41485
348348
df = DataFrame({"a": [1, 2, 3]})
349349
msg = (
350-
r"Starting with Pandas version 2\.0 all arguments of interpolate except "
351-
r"for the arguments 'self' and 'method' will be keyword-only"
350+
r"In a future version of pandas all arguments of DataFrame.interpolate "
351+
r"except for the argument 'method' will be keyword-only"
352352
)
353353
with tm.assert_produces_warning(FutureWarning, match=msg):
354354
df.interpolate("pad", 0)

pandas/tests/series/methods/test_interpolate.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -816,8 +816,8 @@ def test_interpolate_pos_args_deprecation(self):
816816
# https://github.com/pandas-dev/pandas/issues/41485
817817
ser = Series([1, 2, 3])
818818
msg = (
819-
r"Starting with Pandas version 2\.0 all arguments of interpolate except "
820-
r"for the arguments 'self' and 'method' will be keyword-only"
819+
r"In a future version of pandas all arguments of Series.interpolate except "
820+
r"for the argument 'method' will be keyword-only"
821821
)
822822
with tm.assert_produces_warning(FutureWarning, match=msg):
823823
ser.interpolate("pad", 0)

0 commit comments

Comments
 (0)