diff --git a/doc/source/whatsnew/v2.0.0.rst b/doc/source/whatsnew/v2.0.0.rst index fb8f5affe5a7b..91ce5269f7a1b 100644 --- a/doc/source/whatsnew/v2.0.0.rst +++ b/doc/source/whatsnew/v2.0.0.rst @@ -156,6 +156,9 @@ Removal of prior version deprecations/changes - Disallow passing positional arguments to :meth:`MultiIndex.set_levels` and :meth:`MultiIndex.set_codes` (:issue:`41485`) - Removed argument ``try_cast`` from :meth:`DataFrame.mask`, :meth:`DataFrame.where`, :meth:`Series.mask` and :meth:`Series.where` (:issue:`38836`) - Disallow passing non-round floats to :class:`Timestamp` with ``unit="M"`` or ``unit="Y"`` (:issue:`47266`) +- 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`) - Removed deprecated :meth:`Timedelta.delta`, :meth:`Timedelta.is_populated`, and :attr:`Timedelta.freq` (:issue:`46430`, :issue:`46476`) - Removed the ``numeric_only`` keyword from :meth:`Categorical.min` and :meth:`Categorical.max` in favor of ``skipna`` (:issue:`48821`) - Removed :func:`is_extension_type` in favor of :func:`is_extension_array_dtype` (:issue:`29457`) diff --git a/pandas/core/window/rolling.py b/pandas/core/window/rolling.py index 80b782d582561..e13872f1ee1dd 100644 --- a/pandas/core/window/rolling.py +++ b/pandas/core/window/rolling.py @@ -141,8 +141,7 @@ def __init__( self.window = window self.min_periods = min_periods self.center = center - # TODO(2.0): Change this back to self.win_type once deprecation is enforced - self._win_type = win_type + self.win_type = win_type self.axis = obj._get_axis_number(axis) if axis is not None else None self.method = method self._win_freq_i8: int | None = None @@ -165,35 +164,6 @@ def __init__( self._selection = selection self._validate() - @property - def win_type(self): - if self._win_freq_i8 is not None: - warnings.warn( - "win_type will no longer return 'freq' in a future version. " - "Check the type of self.window instead.", - FutureWarning, - stacklevel=find_stack_level(), - ) - return "freq" - return self._win_type - - @property - def is_datetimelike(self) -> bool: - warnings.warn( - "is_datetimelike is deprecated and will be removed in a future version.", - FutureWarning, - stacklevel=find_stack_level(), - ) - return self._win_freq_i8 is not None - - def validate(self) -> None: - warnings.warn( - "validate is deprecated and will be removed in a future version.", - FutureWarning, - stacklevel=find_stack_level(), - ) - return self._validate() - def _validate(self) -> None: if self.center is not None and not is_bool(self.center): raise ValueError("center must be a boolean") @@ -331,10 +301,7 @@ def _gotitem(self, key, ndim, subset=None): # we need to make a shallow copy of ourselves # with the same groupby - with warnings.catch_warnings(): - # TODO(2.0): Remove once win_type deprecation is enforced - warnings.filterwarnings("ignore", "win_type", FutureWarning) - kwargs = {attr: getattr(self, attr) for attr in self._attributes} + kwargs = {attr: getattr(self, attr) for attr in self._attributes} selection = None if subset.ndim == 2 and ( diff --git a/pandas/tests/window/test_api.py b/pandas/tests/window/test_api.py index 6495f7411938c..d55e398acf992 100644 --- a/pandas/tests/window/test_api.py +++ b/pandas/tests/window/test_api.py @@ -340,18 +340,6 @@ def test_multiple_agg_funcs(func, window_size, expected_vals): tm.assert_frame_equal(result, expected) -def test_is_datetimelike_deprecated(): - s = Series(range(1)).rolling(1) - with tm.assert_produces_warning(FutureWarning): - assert not s.is_datetimelike - - -def test_validate_deprecated(): - s = Series(range(1)).rolling(1) - with tm.assert_produces_warning(FutureWarning): - assert s.validate() is None - - @pytest.mark.filterwarnings("ignore:min_periods:FutureWarning") def test_dont_modify_attributes_after_methods( arithmetic_win_operators, closed, center, min_periods, step diff --git a/pandas/tests/window/test_win_type.py b/pandas/tests/window/test_win_type.py index db03fa880085d..b5206d802776b 100644 --- a/pandas/tests/window/test_win_type.py +++ b/pandas/tests/window/test_win_type.py @@ -168,10 +168,10 @@ def test_consistent_win_type_freq(arg): s.rolling(arg, win_type="freq") -def test_win_type_freq_return_deprecation(): +def test_win_type_freq_return_none(): + # GH 48838 freq_roll = Series(range(2), index=date_range("2020", periods=2)).rolling("2s") - with tm.assert_produces_warning(FutureWarning): - assert freq_roll.win_type == "freq" + assert freq_roll.win_type is None @td.skip_if_no_scipy