Skip to content

Categorical: let unique only return used categories #8937

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

Merged
merged 1 commit into from
Nov 30, 2014

Conversation

jankatins
Copy link
Contributor

Discussion see here: #8559 (comment)

@jreback jreback added API Design Categorical Categorical Data Type labels Nov 29, 2014
@jreback jreback added this to the 0.15.2 milestone Nov 29, 2014
@jreback
Copy link
Contributor

jreback commented Nov 29, 2014

put a release note referincing that issue. I think this is already in the API.rst ? (maybe just check doc-string too).

@jankatins
Copy link
Contributor Author

Categorical.unique is not in api.rst, only methods under Series.cat are.

re release note: under API change or bug fix?

@jreback
Copy link
Contributor

jreback commented Nov 29, 2014

ahh, so maybe add to Series.cat methods? I forgot how we are calling this

s.unique() of course does it, but I suppose s.cat.unique() should be allowed as well?

This 'changes' the API slightly so API change it is. (maybe put a short explanation), example if you feel it is waranted.

@jankatins
Copy link
Contributor Author

ok, added it under api change (without an example)

I don't think any more methods should be added to Series.cat: simple calling s.unique() (or s.min() or s.describe()) is enough. After the last discussion about what is API and what is not, I started to think of all methods in Categorical as "for compatibility with numpy" and I think that's the right way to think about them. If a users knows better they can look at the docstrings, but I don't think pandas should do any API guarantee whether these methods stay or change or be removed.

@@ -42,6 +42,9 @@ API changes

- Bug in concat of Series with ``category`` dtype which were coercing to ``object``. (:issue:`8641`)

- Bug in unique of Series with ``category`` dtype, which returned all categories regardless
whether they were "used" or not.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add a reference to the original issue here

jreback added a commit that referenced this pull request Nov 30, 2014
Categorical: let unique only return used categories
@jreback jreback merged commit 8290a4d into pandas-dev:master Nov 30, 2014
@jreback
Copy link
Contributor

jreback commented Nov 30, 2014

thanks!

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

Successfully merging this pull request may close these issues.

2 participants