Skip to content

Commit

Permalink
DEPR: Series.cat.categorical (#29914)
Browse files Browse the repository at this point in the history
  • Loading branch information
jbrockmendel authored and jorisvandenbossche committed Nov 28, 2019
1 parent 20ff599 commit ea2e26a
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 50 deletions.
1 change: 1 addition & 0 deletions doc/source/whatsnew/v1.0.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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`)
Expand Down
37 changes: 0 additions & 37 deletions pandas/core/arrays/categorical.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
13 changes: 0 additions & 13 deletions pandas/tests/arrays/categorical/test_warnings.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import pytest

import pandas as pd
import pandas.util.testing as tm


Expand All @@ -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

0 comments on commit ea2e26a

Please sign in to comment.