CategoricalAccessor.categorical removed in 0.24.0rc1 · Issue #24751 · pandas-dev/pandas (original) (raw)

Previously, CategoricalAccessor set .categorical in __init__. I don't think this was intended to be the way to access things like .ordered, but it wasn't prefixed with an underscore, so we should deprecate before removing

0.23.4

In [11]: pd.Series(['a', 'b'], dtype='category').cat.categorical.ordered Out[11]: False

0.24.0rc1

In [3]: pd.Series(['a', 'b'], dtype='category').cat.categorical.ordered

AttributeError Traceback (most recent call last) in ----> 1 pd.Series(['a', 'b'], dtype='category').cat.categorical.ordered

AttributeError: 'CategoricalAccessor' object has no attribute 'categorical'

We can deprecate with

def categorical(self): warnings.warn(...) return self._parent

in

class CategoricalAccessor(PandasDelegate, PandasObject, NoNewAttributesMixin):

We should do the same for .index and .name.