Skip to content

API: CategoricalDtype str, repr #17781

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

Closed
TomAugspurger opened this issue Oct 4, 2017 · 1 comment
Closed

API: CategoricalDtype str, repr #17781

TomAugspurger opened this issue Oct 4, 2017 · 1 comment

Comments

@TomAugspurger
Copy link
Contributor

I think that str(cat.dtype) should be changed back to always being 'category'. I've seen several places where people use str(thing.dtype) == 'category' as a way to check for Categoricals. Even subtle things like this arrow PR would break.

So instead of

In [6]: str(pd.Categorical([1, 2, 3]).dtype)
Out[6]: 'CategoricalDtype(categories=[1, 2, 3], ordered=False)'

it would be

Out[6]: 'category'

We can leave __repr__ to be unambiguous.

@TomAugspurger
Copy link
Contributor Author

Double posted with #17782

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant