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
Labels
Blocker Blocking issue or pull request for an upcoming release Categorical Categorical Data Type Dependencies Required and optional dependencies good first issue
Milestone

Comments

@TomAugspurger
Copy link
Contributor

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.

@TomAugspurger TomAugspurger added Blocker Blocking issue or pull request for an upcoming release Categorical Categorical Data Type Effort Low Dependencies Required and optional dependencies good first issue labels Jan 13, 2019
@TomAugspurger TomAugspurger added this to the 0.24.0 milestone Jan 13, 2019
@benjaminr
Copy link
Contributor

Will take a look at this one.

@jreback
Copy link
Contributor

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 commented Jan 13, 2019 via email

@jreback
Copy link
Contributor

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 commented Jan 13, 2019 via email

@jreback
Copy link
Contributor

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 commented Jan 13, 2019 via email

@jorisvandenbossche
Copy link
Member

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

@jorisvandenbossche sure thing 👍

TomAugspurger pushed a commit that referenced this issue Jan 15, 2019
…4754)

* Implementation for CategoricalAccessor.categorical removed in 0.24.0rc1 #24751
Pingviinituutti pushed 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 pushed 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
Labels
Blocker Blocking issue or pull request for an upcoming release Categorical Categorical Data Type Dependencies Required and optional dependencies good first issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants