Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CategoricalAccessor.categorical removed in 0.24.0rc1 #24751

Closed
TomAugspurger opened this issue Jan 13, 2019 · 9 comments

Comments

Projects
None yet
4 participants
@TomAugspurger
Copy link
Contributor

commented Jan 13, 2019

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)
<ipython-input-3-e5c7f0300480> in <module>
----> 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.

@benjaminr

This comment has been minimized.

Copy link
Contributor

commented Jan 13, 2019

Will take a look at this one.

@jreback

This comment has been minimized.

Copy link
Contributor

commented Jan 13, 2019

I am not sure we need to deprecate this at all. This is a non-public interface to begin with (and not in-line with anything else in pandas).

@TomAugspurger

This comment has been minimized.

Copy link
Contributor Author

commented Jan 13, 2019

@jreback

This comment has been minimized.

Copy link
Contributor

commented Jan 13, 2019

It wasn't prefixed with an underscore.

lots of things are not prefixed with underscored. .categoricals is not a valid construction, nor was this ever advertised / documented. This is taking deprecations too far.

@TomAugspurger

This comment has been minimized.

Copy link
Contributor Author

commented Jan 13, 2019

@jreback

This comment has been minimized.

Copy link
Contributor

commented Jan 13, 2019

@TomAugspurger not convinced, we havemany places where you can access attributes; and we have changed any of these. This is a very very minor case. I don't think the deprecation is worth it.

@TomAugspurger

This comment has been minimized.

Copy link
Contributor Author

commented Jan 13, 2019

@jorisvandenbossche

This comment has been minimized.

Copy link
Member

commented Jan 14, 2019

It is very simple to deprecate it (it's not adding complexity to the non-deprecated code), so let's just do it.

@benjaminr can you re-open your PR?

@benjaminr

This comment has been minimized.

Copy link
Contributor

commented Jan 14, 2019

@jorisvandenbossche sure thing 👍

@jsexauer jsexauer referenced this issue Jan 15, 2019

Open

DEPR: deprecations from prior versions #6581

0 of 94 tasks complete

TomAugspurger added a commit that referenced this issue Jan 15, 2019

DEPR: CategoricalAccessor.categorical removed in 0.24.0rc1 #24751 (#2…
…4754)

* Implementation for CategoricalAccessor.categorical removed in 0.24.0rc1 #24751

Pingviinituutti added a commit to Pingviinituutti/pandas that referenced this issue Feb 28, 2019

DEPR: CategoricalAccessor.categorical removed in 0.24.0rc1 pandas-dev…
…#24751 (pandas-dev#24754)

* Implementation for CategoricalAccessor.categorical removed in 0.24.0rc1 pandas-dev#24751

Pingviinituutti added a commit to Pingviinituutti/pandas that referenced this issue Feb 28, 2019

DEPR: CategoricalAccessor.categorical removed in 0.24.0rc1 pandas-dev…
…#24751 (pandas-dev#24754)

* Implementation for CategoricalAccessor.categorical removed in 0.24.0rc1 pandas-dev#24751
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.