diff --git a/asv_bench/benchmarks/io/stata.py b/asv_bench/benchmarks/io/stata.py index 4ae2745af8bff..1ff929d6dbdea 100644 --- a/asv_bench/benchmarks/io/stata.py +++ b/asv_bench/benchmarks/io/stata.py @@ -38,13 +38,13 @@ def setup(self, convert_dates): ) self.df["float32_"] = np.array(np.random.randn(N), dtype=np.float32) self.convert_dates = {"index": convert_dates} - self.df.to_stata(self.fname, self.convert_dates) + self.df.to_stata(self.fname, convert_dates=self.convert_dates) def time_read_stata(self, convert_dates): read_stata(self.fname) def time_write_stata(self, convert_dates): - self.df.to_stata(self.fname, self.convert_dates) + self.df.to_stata(self.fname, convert_dates=self.convert_dates) class StataMissing(Stata): @@ -54,7 +54,7 @@ def setup(self, convert_dates): missing_data = np.random.randn(self.N) missing_data[missing_data < 0] = np.nan self.df[f"missing_{i}"] = missing_data - self.df.to_stata(self.fname, self.convert_dates) + self.df.to_stata(self.fname, convert_dates=self.convert_dates) from ..pandas_vb_common import setup # noqa: F401 isort:skip diff --git a/doc/source/whatsnew/v2.0.0.rst b/doc/source/whatsnew/v2.0.0.rst index ff26df96d1a89..19018f300b59a 100644 --- a/doc/source/whatsnew/v2.0.0.rst +++ b/doc/source/whatsnew/v2.0.0.rst @@ -186,6 +186,16 @@ Removal of prior version deprecations/changes - Disallow passing non-round floats to :class:`Timestamp` with ``unit="M"`` or ``unit="Y"`` (:issue:`47266`) - Remove keywords ``convert_float`` and ``mangle_dupe_cols`` from :func:`read_excel` (:issue:`41176`) - Disallow passing non-keyword arguments to :func:`read_excel` except ``io`` and ``sheet_name`` (:issue:`34418`) +- Disallow passing non-keyword arguments to :meth:`Series.mask` and :meth:`DataFrame.mask` except ``cond`` and ``other`` (:issue:`41580`) +- Disallow passing non-keyword arguments to :meth:`DataFrame.to_stata` except for ``path`` (:issue:`48128`) +- Disallow passing non-keyword arguments to :meth:`DataFrame.where` and :meth:`Series.where` except for ``cond`` and ``other`` (:issue:`41523`) +- Disallow passing non-keyword arguments to :meth:`Series.set_axis` and :meth:`DataFrame.set_axis` except for ``labels`` (:issue:`41491`) +- Disallow passing non-keyword arguments to :meth:`Series.rename_axis` and :meth:`DataFrame.rename_axis` except for ``mapper`` (:issue:`47587`) +- Disallow passing non-keyword arguments to :meth:`Series.clip` and :meth:`DataFrame.clip` (:issue:`41511`) +- Disallow passing non-keyword arguments to :meth:`Series.bfill`, :meth:`Series.ffill`, :meth:`DataFrame.bfill` and :meth:`DataFrame.ffill` (:issue:`41508`) +- Disallow passing non-keyword arguments to :meth:`DataFrame.replace`, :meth:`Series.replace` except for ``to_replace`` and ``value`` (:issue:`47587`) +- Disallow passing non-keyword arguments to :meth:`DataFrame.sort_values` except for ``by`` (:issue:`41505`) +- Disallow passing non-keyword arguments to :meth:`Series.sort_values` (:issue:`41505`) - Removed :meth:`.Rolling.validate`, :meth:`.Expanding.validate`, and :meth:`.ExponentialMovingWindow.validate` (:issue:`43665`) - Removed :attr:`Rolling.win_type` returning ``"freq"`` (:issue:`38963`) - Removed :attr:`Rolling.is_datetimelike` (:issue:`38963`) diff --git a/pandas/core/frame.py b/pandas/core/frame.py index fb333aff66b72..0cac5d621fd0c 100644 --- a/pandas/core/frame.py +++ b/pandas/core/frame.py @@ -2621,10 +2621,10 @@ def _from_arrays( compression_options=_shared_docs["compression_options"] % "path", ) @deprecate_kwarg(old_arg_name="fname", new_arg_name="path") - @deprecate_nonkeyword_arguments(version=None, allowed_args=["self", "path"]) def to_stata( self, path: FilePath | WriteBuffer[bytes], + *, convert_dates: dict[Hashable, str] | None = None, write_index: bool = True, byteorder: str | None = None, @@ -2635,7 +2635,6 @@ def to_stata( convert_strl: Sequence[Hashable] | None = None, compression: CompressionOptions = "infer", storage_options: StorageOptions = None, - *, value_labels: dict[Hashable, dict[float, str]] | None = None, ) -> None: """ @@ -5141,7 +5140,6 @@ def set_axis( ... # error: Signature of "set_axis" incompatible with supertype "NDFrame" - @deprecate_nonkeyword_arguments(version=None, allowed_args=["self", "labels"]) @Appender( """ Examples @@ -5183,9 +5181,9 @@ def set_axis( def set_axis( self, labels, + *, axis: Axis = 0, inplace: bool | lib.NoDefault = lib.no_default, - *, copy: bool | lib.NoDefault = lib.no_default, ): return super().set_axis(labels, axis=axis, inplace=inplace, copy=copy) @@ -5719,14 +5717,12 @@ def replace( ... # error: Signature of "replace" incompatible with supertype "NDFrame" - @deprecate_nonkeyword_arguments( - version=None, allowed_args=["self", "to_replace", "value"] - ) @doc(NDFrame.replace, **_shared_doc_kwargs) def replace( # type: ignore[override] self, to_replace=None, value=lib.no_default, + *, inplace: bool = False, limit: int | None = None, regex: bool = False, @@ -6868,12 +6864,12 @@ def sort_values( # TODO: Just move the sort_values doc here. # error: Signature of "sort_values" incompatible with supertype "NDFrame" - @deprecate_nonkeyword_arguments(version=None, allowed_args=["self", "by"]) @Substitution(**_shared_doc_kwargs) @Appender(NDFrame.sort_values.__doc__) def sort_values( # type: ignore[override] self, by: IndexLabel, + *, axis: Axis = 0, ascending: bool | list[bool] | tuple[bool, ...] = True, inplace: bool = False, @@ -11776,10 +11772,9 @@ def ffill( ) -> DataFrame | None: ... - # error: Signature of "ffill" incompatible with supertype "NDFrame" - @deprecate_nonkeyword_arguments(version=None, allowed_args=["self"]) - def ffill( # type: ignore[override] + def ffill( self, + *, axis: None | Axis = None, inplace: bool = False, limit: None | int = None, @@ -11820,10 +11815,9 @@ def bfill( ) -> DataFrame | None: ... - # error: Signature of "bfill" incompatible with supertype "NDFrame" - @deprecate_nonkeyword_arguments(version=None, allowed_args=["self"]) - def bfill( # type: ignore[override] + def bfill( self, + *, axis: None | Axis = None, inplace: bool = False, limit: None | int = None, @@ -11831,19 +11825,16 @@ def bfill( # type: ignore[override] ) -> DataFrame | None: return super().bfill(axis=axis, inplace=inplace, limit=limit, downcast=downcast) - @deprecate_nonkeyword_arguments( - version=None, allowed_args=["self", "lower", "upper"] - ) def clip( self: DataFrame, lower: float | None = None, upper: float | None = None, + *, axis: Axis | None = None, inplace: bool = False, - *args, **kwargs, ) -> DataFrame | None: - return super().clip(lower, upper, axis, inplace, *args, **kwargs) + return super().clip(lower, upper, axis=axis, inplace=inplace, **kwargs) @deprecate_nonkeyword_arguments(version=None, allowed_args=["self", "method"]) def interpolate( @@ -11909,13 +11900,11 @@ def where( # error: Signature of "where" incompatible with supertype "NDFrame" @deprecate_kwarg(old_arg_name="errors", new_arg_name=None) - @deprecate_nonkeyword_arguments( - version=None, allowed_args=["self", "cond", "other"] - ) def where( # type: ignore[override] self, cond, other=lib.no_default, + *, inplace: bool = False, axis: Axis | None = None, level: Level = None, @@ -11970,13 +11959,11 @@ def mask( # error: Signature of "mask" incompatible with supertype "NDFrame" @deprecate_kwarg(old_arg_name="errors", new_arg_name=None) - @deprecate_nonkeyword_arguments( - version=None, allowed_args=["self", "cond", "other"] - ) def mask( # type: ignore[override] self, cond, other=lib.no_default, + *, inplace: bool = False, axis: Axis | None = None, level: Level = None, diff --git a/pandas/core/generic.py b/pandas/core/generic.py index 2e1d5a286b386..40dc8e5d60453 100644 --- a/pandas/core/generic.py +++ b/pandas/core/generic.py @@ -750,13 +750,12 @@ def set_axis( ) -> NDFrameT | None: ... - @deprecate_nonkeyword_arguments(version=None, allowed_args=["self", "labels"]) def set_axis( self: NDFrameT, labels, + *, axis: Axis = 0, inplace: bool_t | lib.NoDefault = lib.no_default, - *, copy: bool_t | lib.NoDefault = lib.no_default, ) -> NDFrameT | None: """ @@ -1154,10 +1153,10 @@ def rename_axis( ... @rewrite_axis_style_signature("mapper", [("copy", True)]) - @deprecate_nonkeyword_arguments(version=None, allowed_args=["self", "mapper"]) def rename_axis( self: NDFrameT, mapper: IndexLabel | lib.NoDefault = lib.no_default, + *, inplace: bool_t = False, **kwargs, ) -> NDFrameT | None: @@ -4813,9 +4812,9 @@ def sort_values( ) -> NDFrameT | None: ... - @deprecate_nonkeyword_arguments(version=None, allowed_args=["self"]) def sort_values( self: NDFrameT, + *, axis: Axis = 0, ascending: bool_t | Sequence[bool_t] = True, inplace: bool_t = False, @@ -7007,10 +7006,10 @@ def ffill( ) -> NDFrameT | None: ... - @deprecate_nonkeyword_arguments(version=None, allowed_args=["self"]) @doc(klass=_shared_doc_kwargs["klass"]) def ffill( self: NDFrameT, + *, axis: None | Axis = None, inplace: bool_t = False, limit: None | int = None, @@ -7063,10 +7062,10 @@ def bfill( ) -> NDFrameT | None: ... - @deprecate_nonkeyword_arguments(version=None, allowed_args=["self"]) @doc(klass=_shared_doc_kwargs["klass"]) def bfill( self: NDFrameT, + *, axis: None | Axis = None, inplace: bool_t = False, limit: None | int = None, @@ -7125,9 +7124,6 @@ def replace( ) -> NDFrameT | None: ... - @deprecate_nonkeyword_arguments( - version=None, allowed_args=["self", "to_replace", "value"] - ) @doc( _shared_docs["replace"], klass=_shared_doc_kwargs["klass"], @@ -7138,6 +7134,7 @@ def replace( self: NDFrameT, to_replace=None, value=lib.no_default, + *, inplace: bool_t = False, limit: int | None = None, regex: bool_t = False, @@ -8000,9 +7997,9 @@ def clip( self: NDFrameT, lower=None, upper=None, + *, axis: Axis | None = None, inplace: bool_t = False, - *args, **kwargs, ) -> NDFrameT | None: """ @@ -8105,7 +8102,7 @@ def clip( """ inplace = validate_bool_kwarg(inplace, "inplace") - axis = nv.validate_clip_with_axis(axis, args, kwargs) + axis = nv.validate_clip_with_axis(axis, (), kwargs) if axis is not None: axis = self._get_axis_number(axis) @@ -9827,9 +9824,6 @@ def where( ... @deprecate_kwarg(old_arg_name="errors", new_arg_name=None) - @deprecate_nonkeyword_arguments( - version=None, allowed_args=["self", "cond", "other"] - ) @doc( klass=_shared_doc_kwargs["klass"], cond="True", @@ -9841,6 +9835,7 @@ def where( self: NDFrameT, cond, other=np.nan, + *, inplace: bool_t = False, axis: Axis | None = None, level: Level = None, @@ -10035,9 +10030,6 @@ def mask( ... @deprecate_kwarg(old_arg_name="errors", new_arg_name=None) - @deprecate_nonkeyword_arguments( - version=None, allowed_args=["self", "cond", "other"] - ) @doc( where, klass=_shared_doc_kwargs["klass"], @@ -10050,6 +10042,7 @@ def mask( self: NDFrameT, cond, other=lib.no_default, + *, inplace: bool_t = False, axis: Axis | None = None, level: Level = None, diff --git a/pandas/core/series.py b/pandas/core/series.py index b7d12158fd909..bafc90ee4cf5b 100644 --- a/pandas/core/series.py +++ b/pandas/core/series.py @@ -3523,10 +3523,9 @@ def sort_values( ) -> None: ... - # error: Signature of "sort_values" incompatible with supertype "NDFrame" - @deprecate_nonkeyword_arguments(version=None, allowed_args=["self"]) - def sort_values( # type: ignore[override] + def sort_values( self, + *, axis: Axis = 0, ascending: bool | int | Sequence[bool] | Sequence[int] = True, inplace: bool = False, @@ -4992,7 +4991,6 @@ def set_axis( ... # error: Signature of "set_axis" incompatible with supertype "NDFrame" - @deprecate_nonkeyword_arguments(version=None, allowed_args=["self", "labels"]) @Appender( """ Examples @@ -5021,6 +5019,7 @@ def set_axis( def set_axis( # type: ignore[override] self, labels, + *, axis: Axis = 0, inplace: bool | lib.NoDefault = lib.no_default, copy: bool | lib.NoDefault = lib.no_default, @@ -5313,9 +5312,6 @@ def replace( ... # error: Signature of "replace" incompatible with supertype "NDFrame" - @deprecate_nonkeyword_arguments( - version=None, allowed_args=["self", "to_replace", "value"] - ) @doc( NDFrame.replace, klass=_shared_doc_kwargs["klass"], @@ -5326,6 +5322,7 @@ def replace( # type: ignore[override] self, to_replace=None, value=lib.no_default, + *, inplace: bool = False, limit: int | None = None, regex: bool = False, @@ -5945,10 +5942,9 @@ def ffill( ) -> Series | None: ... - # error: Signature of "ffill" incompatible with supertype "NDFrame" - @deprecate_nonkeyword_arguments(version=None, allowed_args=["self"]) - def ffill( # type: ignore[override] + def ffill( self, + *, axis: None | Axis = None, inplace: bool = False, limit: None | int = None, @@ -5989,10 +5985,9 @@ def bfill( ) -> Series | None: ... - # error: Signature of "bfill" incompatible with supertype "NDFrame" - @deprecate_nonkeyword_arguments(version=None, allowed_args=["self"]) - def bfill( # type: ignore[override] + def bfill( self, + *, axis: None | Axis = None, inplace: bool = False, limit: None | int = None, @@ -6000,19 +5995,16 @@ def bfill( # type: ignore[override] ) -> Series | None: return super().bfill(axis=axis, inplace=inplace, limit=limit, downcast=downcast) - @deprecate_nonkeyword_arguments( - version=None, allowed_args=["self", "lower", "upper"] - ) def clip( self: Series, lower=None, upper=None, + *, axis: Axis | None = None, inplace: bool = False, - *args, **kwargs, ) -> Series | None: - return super().clip(lower, upper, axis, inplace, *args, **kwargs) + return super().clip(lower, upper, axis=axis, inplace=inplace, **kwargs) @deprecate_nonkeyword_arguments(version=None, allowed_args=["self", "method"]) def interpolate( @@ -6078,13 +6070,11 @@ def where( # error: Signature of "where" incompatible with supertype "NDFrame" @deprecate_kwarg(old_arg_name="errors", new_arg_name=None) - @deprecate_nonkeyword_arguments( - version=None, allowed_args=["self", "cond", "other"] - ) def where( # type: ignore[override] self, cond, other=lib.no_default, + *, inplace: bool = False, axis: Axis | None = None, level: Level = None, @@ -6139,13 +6129,11 @@ def mask( # error: Signature of "mask" incompatible with supertype "NDFrame" @deprecate_kwarg(old_arg_name="errors", new_arg_name=None) - @deprecate_nonkeyword_arguments( - version=None, allowed_args=["self", "cond", "other"] - ) def mask( # type: ignore[override] self, cond, other=lib.no_default, + *, inplace: bool = False, axis: Axis | None = None, level: Level = None, diff --git a/pandas/tests/frame/indexing/test_mask.py b/pandas/tests/frame/indexing/test_mask.py index 3a31123da7679..e8a49ab868425 100644 --- a/pandas/tests/frame/indexing/test_mask.py +++ b/pandas/tests/frame/indexing/test_mask.py @@ -92,23 +92,6 @@ def test_mask_dtype_bool_conversion(self): result = bools.mask(mask) tm.assert_frame_equal(result, expected) - def test_mask_pos_args_deprecation(self, frame_or_series): - # https://github.com/pandas-dev/pandas/issues/41485 - obj = DataFrame({"a": range(5)}) - expected = DataFrame({"a": [-1, 1, -1, 3, -1]}) - obj = tm.get_obj(obj, frame_or_series) - expected = tm.get_obj(expected, frame_or_series) - - cond = obj % 2 == 0 - msg = ( - r"In a future version of pandas all arguments of " - f"{frame_or_series.__name__}.mask except for " - r"the arguments 'cond' and 'other' will be keyword-only" - ) - with tm.assert_produces_warning(FutureWarning, match=msg): - result = obj.mask(cond, -1, False) - tm.assert_equal(result, expected) - def test_mask_stringdtype(frame_or_series): # GH 40824 diff --git a/pandas/tests/frame/indexing/test_where.py b/pandas/tests/frame/indexing/test_where.py index ea559230d1595..1212659ea24e2 100644 --- a/pandas/tests/frame/indexing/test_where.py +++ b/pandas/tests/frame/indexing/test_where.py @@ -863,20 +863,6 @@ def test_where_duplicate_axes_mixed_dtypes(): tm.assert_frame_equal(c.astype("f8"), d.astype("f8")) -def test_where_non_keyword_deprecation(frame_or_series): - # GH 41485 - obj = frame_or_series(range(5)) - msg = ( - "In a future version of pandas all arguments of " - f"{frame_or_series.__name__}.where except for the arguments 'cond' " - "and 'other' will be keyword-only" - ) - with tm.assert_produces_warning(FutureWarning, match=msg): - result = obj.where(obj > 1, 10, False) - expected = frame_or_series([10, 10, 2, 3, 4]) - tm.assert_equal(expected, result) - - def test_where_columns_casting(): # GH 42295 diff --git a/pandas/tests/frame/methods/test_clip.py b/pandas/tests/frame/methods/test_clip.py index c851e65a7ad4f..f8d9adf44dbc2 100644 --- a/pandas/tests/frame/methods/test_clip.py +++ b/pandas/tests/frame/methods/test_clip.py @@ -164,15 +164,3 @@ def test_clip_with_na_args(self, float_frame): result = df.clip(lower=t, axis=0) expected = DataFrame({"col_0": [9, -3, 0, 6, 5], "col_1": [2, -4, 6, 8, 3]}) tm.assert_frame_equal(result, expected) - - def test_clip_pos_args_deprecation(self): - # https://github.com/pandas-dev/pandas/issues/41485 - df = DataFrame({"a": [1, 2, 3]}) - msg = ( - r"In a future version of pandas all arguments of DataFrame.clip except " - r"for the arguments 'lower' and 'upper' will be keyword-only" - ) - with tm.assert_produces_warning(FutureWarning, match=msg): - result = df.clip(0, 1, 0) - expected = DataFrame({"a": [1, 1, 1]}) - tm.assert_frame_equal(result, expected) diff --git a/pandas/tests/frame/methods/test_fillna.py b/pandas/tests/frame/methods/test_fillna.py index ccd564b46cffa..869cd32aa9ef9 100644 --- a/pandas/tests/frame/methods/test_fillna.py +++ b/pandas/tests/frame/methods/test_fillna.py @@ -399,18 +399,6 @@ def test_ffill(self, datetime_frame): datetime_frame.ffill(), datetime_frame.fillna(method="ffill") ) - def test_ffill_pos_args_deprecation(self): - # https://github.com/pandas-dev/pandas/issues/41485 - df = DataFrame({"a": [1, 2, 3]}) - msg = ( - r"In a future version of pandas all arguments of DataFrame.ffill " - r"will be keyword-only" - ) - with tm.assert_produces_warning(FutureWarning, match=msg): - result = df.ffill(0) - expected = DataFrame({"a": [1, 2, 3]}) - tm.assert_frame_equal(result, expected) - def test_bfill(self, datetime_frame): datetime_frame["A"][:5] = np.nan datetime_frame["A"][-5:] = np.nan @@ -419,18 +407,6 @@ def test_bfill(self, datetime_frame): datetime_frame.bfill(), datetime_frame.fillna(method="bfill") ) - def test_bfill_pos_args_deprecation(self): - # https://github.com/pandas-dev/pandas/issues/41485 - df = DataFrame({"a": [1, 2, 3]}) - msg = ( - r"In a future version of pandas all arguments of DataFrame.bfill " - r"will be keyword-only" - ) - with tm.assert_produces_warning(FutureWarning, match=msg): - result = df.bfill(0) - expected = DataFrame({"a": [1, 2, 3]}) - tm.assert_frame_equal(result, expected) - def test_frame_pad_backfill_limit(self): index = np.arange(10) df = DataFrame(np.random.randn(10, 4), index=index) diff --git a/pandas/tests/frame/methods/test_set_axis.py b/pandas/tests/frame/methods/test_set_axis.py index f105a38e6fdd0..8e597e1e9fa69 100644 --- a/pandas/tests/frame/methods/test_set_axis.py +++ b/pandas/tests/frame/methods/test_set_axis.py @@ -168,26 +168,3 @@ class TestSeriesSetAxis(SharedSetAxisTests): def obj(self): ser = Series(np.arange(4), index=[1, 3, 5, 7], dtype="int64") return ser - - -def test_nonkeyword_arguments_deprecation_warning(): - # https://github.com/pandas-dev/pandas/issues/41485 - df = DataFrame({"a": [1, 2, 3]}) - msg = ( - r"In a future version of pandas all arguments of DataFrame\.set_axis " - r"except for the argument 'labels' will be keyword-only" - ) - with tm.assert_produces_warning(FutureWarning, match=msg): - result = df.set_axis([1, 2, 4], 0) - expected = DataFrame({"a": [1, 2, 3]}, index=[1, 2, 4]) - tm.assert_frame_equal(result, expected) - - ser = Series([1, 2, 3]) - msg = ( - r"In a future version of pandas all arguments of Series\.set_axis " - r"except for the argument 'labels' will be keyword-only" - ) - with tm.assert_produces_warning(FutureWarning, match=msg): - result = ser.set_axis([1, 2, 4], 0) - expected = Series([1, 2, 3], index=[1, 2, 4]) - tm.assert_series_equal(result, expected) diff --git a/pandas/tests/frame/methods/test_sort_values.py b/pandas/tests/frame/methods/test_sort_values.py index 51b590263f893..d7f1d900db052 100644 --- a/pandas/tests/frame/methods/test_sort_values.py +++ b/pandas/tests/frame/methods/test_sort_values.py @@ -860,18 +860,6 @@ def test_sort_column_level_and_index_label( tm.assert_frame_equal(result, expected) - def test_sort_values_pos_args_deprecation(self): - # https://github.com/pandas-dev/pandas/issues/41485 - df = DataFrame({"a": [1, 2, 3]}) - msg = ( - r"In a future version of pandas all arguments of DataFrame\.sort_values " - r"except for the argument 'by' will be keyword-only" - ) - with tm.assert_produces_warning(FutureWarning, match=msg): - result = df.sort_values("a", 0) - expected = DataFrame({"a": [1, 2, 3]}) - tm.assert_frame_equal(result, expected) - def test_sort_values_validate_ascending_for_value_error(self): # GH41634 df = DataFrame({"D": [23, 7, 21]}) diff --git a/pandas/tests/io/test_stata.py b/pandas/tests/io/test_stata.py index 566b2e4cd9353..368e9d5f6e6a1 100644 --- a/pandas/tests/io/test_stata.py +++ b/pandas/tests/io/test_stata.py @@ -816,8 +816,7 @@ def test_big_dates(self, datapath): # {c : c[-2:] for c in columns} with tm.ensure_clean() as path: expected.index.name = "index" - with tm.assert_produces_warning(FutureWarning, match="keyword-only"): - expected.to_stata(path, date_conversion) + expected.to_stata(path, convert_dates=date_conversion) written_and_read_again = self.read_dta(path) tm.assert_frame_equal( written_and_read_again.set_index("index"), diff --git a/pandas/tests/series/methods/test_clip.py b/pandas/tests/series/methods/test_clip.py index bc6d5aeb0a581..b123e8a12a852 100644 --- a/pandas/tests/series/methods/test_clip.py +++ b/pandas/tests/series/methods/test_clip.py @@ -137,15 +137,3 @@ def test_clip_with_timestamps_and_oob_datetimes(self): expected = Series([Timestamp.min, Timestamp.max], dtype="object") tm.assert_series_equal(result, expected) - - def test_clip_pos_args_deprecation(self): - # https://github.com/pandas-dev/pandas/issues/41485 - ser = Series([1, 2, 3]) - msg = ( - r"In a future version of pandas all arguments of Series.clip except " - r"for the arguments 'lower' and 'upper' will be keyword-only" - ) - with tm.assert_produces_warning(FutureWarning, match=msg): - result = ser.clip(0, 1, 0) - expected = Series([1, 1, 1]) - tm.assert_series_equal(result, expected) diff --git a/pandas/tests/series/methods/test_fillna.py b/pandas/tests/series/methods/test_fillna.py index ac12b513aad4e..26416c7a2b483 100644 --- a/pandas/tests/series/methods/test_fillna.py +++ b/pandas/tests/series/methods/test_fillna.py @@ -888,18 +888,6 @@ def test_ffill(self): ts[2] = np.NaN tm.assert_series_equal(ts.ffill(), ts.fillna(method="ffill")) - def test_ffill_pos_args_deprecation(self): - # https://github.com/pandas-dev/pandas/issues/41485 - ser = Series([1, 2, 3]) - msg = ( - r"In a future version of pandas all arguments of Series.ffill " - r"will be keyword-only" - ) - with tm.assert_produces_warning(FutureWarning, match=msg): - result = ser.ffill(0) - expected = Series([1, 2, 3]) - tm.assert_series_equal(result, expected) - def test_ffill_mixed_dtypes_without_missing_data(self): # GH#14956 series = Series([datetime(2015, 1, 1, tzinfo=pytz.utc), 1]) @@ -911,18 +899,6 @@ def test_bfill(self): ts[2] = np.NaN tm.assert_series_equal(ts.bfill(), ts.fillna(method="bfill")) - def test_bfill_pos_args_deprecation(self): - # https://github.com/pandas-dev/pandas/issues/41485 - ser = Series([1, 2, 3]) - msg = ( - r"In a future version of pandas all arguments of Series.bfill " - r"will be keyword-only" - ) - with tm.assert_produces_warning(FutureWarning, match=msg): - result = ser.bfill(0) - expected = Series([1, 2, 3]) - tm.assert_series_equal(result, expected) - def test_pad_nan(self): x = Series( [np.nan, 1.0, np.nan, 3.0, np.nan], ["z", "a", "b", "c", "d"], dtype=float diff --git a/pandas/tests/series/methods/test_sort_values.py b/pandas/tests/series/methods/test_sort_values.py index adc578d948163..b5f589b3b2514 100644 --- a/pandas/tests/series/methods/test_sort_values.py +++ b/pandas/tests/series/methods/test_sort_values.py @@ -187,18 +187,6 @@ def test_sort_values_ignore_index( tm.assert_series_equal(result_ser, expected) tm.assert_series_equal(ser, Series(original_list)) - def test_sort_values_pos_args_deprecation(self): - # https://github.com/pandas-dev/pandas/issues/41485 - ser = Series([1, 2, 3]) - msg = ( - r"In a future version of pandas all arguments of Series\.sort_values " - r"will be keyword-only" - ) - with tm.assert_produces_warning(FutureWarning, match=msg): - result = ser.sort_values(0) - expected = Series([1, 2, 3]) - tm.assert_series_equal(result, expected) - def test_mergesort_decending_stability(self): # GH 28697 s = Series([1, 2, 1, 3], ["first", "b", "second", "c"])