Skip to content

Commit 7b6ee76

Browse files
committed
allow method to be positional
1 parent f1ac08b commit 7b6ee76

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

doc/source/whatsnew/v1.3.0.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -647,7 +647,7 @@ Deprecations
647647
- Deprecated setting :attr:`Categorical._codes`, create a new :class:`Categorical` with the desired codes instead (:issue:`40606`)
648648
- Deprecated behavior of :meth:`DatetimeIndex.union` with mixed timezones; in a future version both will be cast to UTC instead of object dtype (:issue:`39328`)
649649
- Deprecated using ``usecols`` with out of bounds indices for ``read_csv`` with ``engine="c"`` (:issue:`25623`)
650-
- Deprecated passing arguments as positional in :meth:`DataFrame.interpolate` and :meth:`Series.interpolate` (:issue:`41485`)
650+
- Deprecated passing arguments as positional (except for ``"method"``) in :meth:`DataFrame.interpolate` and :meth:`Series.interpolate` (:issue:`41485`)
651651

652652
.. ---------------------------------------------------------------------------
653653

pandas/core/generic.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -6697,7 +6697,7 @@ def replace(
66976697
else:
66986698
return result.__finalize__(self, method="replace")
66996699

6700-
@deprecate_nonkeyword_arguments(version="2.0", allowed_args=["self"])
6700+
@deprecate_nonkeyword_arguments(version="2.0", allowed_args=["self", "method"])
67016701
@final
67026702
def interpolate(
67036703
self: FrameOrSeries,

pandas/tests/frame/methods/test_interpolate.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ def test_interpolate_pos_args_deprecation(self):
348348
df = DataFrame({"a": [1, 2, 3]})
349349
msg = (
350350
r"Starting with Pandas version 2\.0 all arguments of interpolate except "
351-
r"for the argument 'self' will be keyword-only"
351+
r"for the arguments 'self' and 'method' will be keyword-only"
352352
)
353353
with tm.assert_produces_warning(FutureWarning, match=msg):
354-
df.interpolate(0)
354+
df.interpolate("pad", 0)

pandas/tests/series/methods/test_interpolate.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -817,7 +817,7 @@ def test_interpolate_pos_args_deprecation(self):
817817
ser = Series([1, 2, 3])
818818
msg = (
819819
r"Starting with Pandas version 2\.0 all arguments of interpolate except "
820-
r"for the argument 'self' will be keyword-only"
820+
r"for the arguments 'self' and 'method' will be keyword-only"
821821
)
822822
with tm.assert_produces_warning(FutureWarning, match=msg):
823-
ser.interpolate(0)
823+
ser.interpolate("pad", 0)

0 commit comments

Comments
 (0)