diff --git a/doc/source/whatsnew/v1.3.0.rst b/doc/source/whatsnew/v1.3.0.rst index f881cf569118aa..7d376a90ae2047 100644 --- a/doc/source/whatsnew/v1.3.0.rst +++ b/doc/source/whatsnew/v1.3.0.rst @@ -647,7 +647,7 @@ Deprecations - Deprecated setting :attr:`Categorical._codes`, create a new :class:`Categorical` with the desired codes instead (:issue:`40606`) - 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`) - Deprecated using ``usecols`` with out of bounds indices for ``read_csv`` with ``engine="c"`` (:issue:`25623`) -- Deprecated passing arguments as positional in :meth:`DataFrame.interpolate` and :meth:`Series.interpolate` (:issue:`41485`) +- Deprecated passing arguments as positional (except for ``"method"``) in :meth:`DataFrame.interpolate` and :meth:`Series.interpolate` (:issue:`41485`) .. --------------------------------------------------------------------------- diff --git a/pandas/core/generic.py b/pandas/core/generic.py index 68112fadcf5148..458524c812c8a7 100644 --- a/pandas/core/generic.py +++ b/pandas/core/generic.py @@ -6697,7 +6697,7 @@ def replace( else: return result.__finalize__(self, method="replace") - @deprecate_nonkeyword_arguments(version="2.0", allowed_args=["self"]) + @deprecate_nonkeyword_arguments(version="2.0", allowed_args=["self", "method"]) @final def interpolate( self: FrameOrSeries, diff --git a/pandas/tests/frame/methods/test_interpolate.py b/pandas/tests/frame/methods/test_interpolate.py index e55a25702319cc..fe95ac328f11ef 100644 --- a/pandas/tests/frame/methods/test_interpolate.py +++ b/pandas/tests/frame/methods/test_interpolate.py @@ -348,7 +348,7 @@ def test_interpolate_pos_args_deprecation(self): df = DataFrame({"a": [1, 2, 3]}) msg = ( r"Starting with Pandas version 2\.0 all arguments of interpolate except " - r"for the argument 'self' will be keyword-only" + r"for the arguments 'self' and 'method' will be keyword-only" ) with tm.assert_produces_warning(FutureWarning, match=msg): - df.interpolate(0) + df.interpolate("pad", 0) diff --git a/pandas/tests/series/methods/test_interpolate.py b/pandas/tests/series/methods/test_interpolate.py index faaebccd5e8de0..52a24e6670e7aa 100644 --- a/pandas/tests/series/methods/test_interpolate.py +++ b/pandas/tests/series/methods/test_interpolate.py @@ -817,7 +817,7 @@ def test_interpolate_pos_args_deprecation(self): ser = Series([1, 2, 3]) msg = ( r"Starting with Pandas version 2\.0 all arguments of interpolate except " - r"for the argument 'self' will be keyword-only" + r"for the arguments 'self' and 'method' will be keyword-only" ) with tm.assert_produces_warning(FutureWarning, match=msg): - ser.interpolate(0) + ser.interpolate("pad", 0)