From 58a126545503c90e272ce1f5d335fd047e5de73d Mon Sep 17 00:00:00 2001 From: jbrockmendel Date: Wed, 27 Nov 2019 23:46:46 -0800 Subject: [PATCH] DEPR: Series.cat.categorical (#29914) --- doc/source/whatsnew/v1.0.0.rst | 1 + pandas/core/arrays/categorical.py | 37 ------------------- .../tests/arrays/categorical/test_warnings.py | 13 ------- 3 files changed, 1 insertion(+), 50 deletions(-) diff --git a/doc/source/whatsnew/v1.0.0.rst b/doc/source/whatsnew/v1.0.0.rst index 3c368eabadd1bb..e54397e635c77f 100644 --- a/doc/source/whatsnew/v1.0.0.rst +++ b/doc/source/whatsnew/v1.0.0.rst @@ -407,6 +407,7 @@ or ``matplotlib.Axes.plot``. See :ref:`plotting.formatters` for more. - Removed the previously deprecated "fastpath" keyword from the :class:`Index` constructor (:issue:`23110`) - Removed the previously deprecated :meth:`Series.get_value`, :meth:`Series.set_value`, :meth:`DataFrame.get_value`, :meth:`DataFrame.set_value` (:issue:`17739`) - Changed the the default value of `inplace` in :meth:`DataFrame.set_index` and :meth:`Series.set_axis`. It now defaults to False (:issue:`27600`) +- Removed the previously deprecated :attr:`Series.cat.categorical`, :attr:`Series.cat.index`, :attr:`Series.cat.name` (:issue:`24751`) - Removed support for nested renaming in :meth:`DataFrame.aggregate`, :meth:`Series.aggregate`, :meth:`DataFrameGroupBy.aggregate`, :meth:`SeriesGroupBy.aggregate`, :meth:`Rolling.aggregate` (:issue:`18529`) - Passing ``datetime64`` data to :class:`TimedeltaIndex` or ``timedelta64`` data to ``DatetimeIndex`` now raises ``TypeError`` (:issue:`23539`, :issue:`23937`) - A tuple passed to :meth:`DataFrame.groupby` is now exclusively treated as a single key (:issue:`18314`) diff --git a/pandas/core/arrays/categorical.py b/pandas/core/arrays/categorical.py index 6cc3f660fb425f..f20308be1ee095 100644 --- a/pandas/core/arrays/categorical.py +++ b/pandas/core/arrays/categorical.py @@ -2583,43 +2583,6 @@ def _delegate_method(self, name, *args, **kwargs): if res is not None: return Series(res, index=self._index, name=self._name) - @property - def categorical(self): - # Note: Upon deprecation, `test_tab_completion_with_categorical` will - # need to be updated. `categorical` will need to be removed from - # `ok_for_cat`. - warn( - "`Series.cat.categorical` has been deprecated. Use the " - "attributes on 'Series.cat' directly instead.", - FutureWarning, - stacklevel=2, - ) - return self._parent - - @property - def name(self): - # Note: Upon deprecation, `test_tab_completion_with_categorical` will - # need to be updated. `name` will need to be removed from - # `ok_for_cat`. - warn( - "`Series.cat.name` has been deprecated. Use `Series.name` instead.", - FutureWarning, - stacklevel=2, - ) - return self._name - - @property - def index(self): - # Note: Upon deprecation, `test_tab_completion_with_categorical` will - # need to be updated. `index` will need to be removed from - # ok_for_cat`. - warn( - "`Series.cat.index` has been deprecated. Use `Series.index` instead.", - FutureWarning, - stacklevel=2, - ) - return self._index - # utility routines diff --git a/pandas/tests/arrays/categorical/test_warnings.py b/pandas/tests/arrays/categorical/test_warnings.py index 53733770ed9547..29bd5252dbe3a0 100644 --- a/pandas/tests/arrays/categorical/test_warnings.py +++ b/pandas/tests/arrays/categorical/test_warnings.py @@ -1,6 +1,5 @@ import pytest -import pandas as pd import pandas.util.testing as tm @@ -15,15 +14,3 @@ def test_tab_complete_warning(self, ip): with tm.assert_produces_warning(None): with provisionalcompleter("ignore"): list(ip.Completer.completions("c.", 1)) - - def test_CategoricalAccessor_categorical_deprecation(self): - with tm.assert_produces_warning(FutureWarning): - pd.Series(["a", "b"], dtype="category").cat.categorical - - def test_CategoricalAccessor_name_deprecation(self): - with tm.assert_produces_warning(FutureWarning): - pd.Series(["a", "b"], dtype="category").cat.name - - def test_CategoricalAccessor_index_deprecation(self): - with tm.assert_produces_warning(FutureWarning): - pd.Series(["a", "b"], dtype="category").cat.index