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 · Fixed by #24754
Closed

CategoricalAccessor.categorical removed in 0.24.0rc1 #24751

TomAugspurger opened this issue Jan 13, 2019 · 9 comments · Fixed by #24754

Comments

@TomAugspurger
Copy link
Contributor

@TomAugspurger TomAugspurger 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
Copy link
Contributor

@benjaminr benjaminr commented Jan 13, 2019

Will take a look at this one.

@jreback
Copy link
Contributor

@jreback jreback 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
Copy link
Contributor Author

@TomAugspurger TomAugspurger commented Jan 13, 2019

@jreback
Copy link
Contributor

@jreback jreback 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
Copy link
Contributor Author

@TomAugspurger TomAugspurger commented Jan 13, 2019

@jreback
Copy link
Contributor

@jreback jreback 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
Copy link
Contributor Author

@TomAugspurger TomAugspurger commented Jan 13, 2019

@jorisvandenbossche
Copy link
Member

@jorisvandenbossche jorisvandenbossche 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
Copy link
Contributor

@benjaminr benjaminr commented Jan 14, 2019

@jorisvandenbossche sure thing 👍

TomAugspurger added a commit that referenced this issue Jan 15, 2019
…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
…#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
…#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
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

4 participants