Skip to content

BUG: Groupby with as_index=False raises error when type is Category #34767

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 3 commits into from
Jun 15, 2020

Conversation

rhshadrach
Copy link
Member

This regression was a symptom of DataFrameGroupBy.size ignoring as_index=False. Fixing this now makes the result either a frame or series, so where the internals use size() they now use grouper.size() which always returns a series.

I also implemented @dsaxton's suggestion to make the column named "size" when as_index=False (#5755 (comment)).

@jreback jreback added Categorical Categorical Data Type Groupby labels Jun 14, 2020
@jreback jreback added this to the 1.1 milestone Jun 15, 2020
@jreback jreback merged commit 0f17970 into pandas-dev:master Jun 15, 2020
@jreback
Copy link
Contributor

jreback commented Jun 15, 2020

thanks @rhshadrach

@rhshadrach rhshadrach deleted the categorical_as_index_false branch July 11, 2020 16:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Categorical Categorical Data Type Groupby
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] Groupby with as_index=False raises error when type is Category.
2 participants