Skip to content

BUG: null group spills into final group when grouping on a categorical #10014

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 2 commits into from
Apr 29, 2015

Conversation

evanpw
Copy link
Contributor

@evanpw evanpw commented Apr 29, 2015

Fixes GH #9603

starts[lab] = start
ends[lab] = start + group_size
start += group_size
group_size = 0

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The null group is represented with a label of -1, so it was getting put in the final spot of starts / ends. In the usual case, it would then get overwritten by the last group, but when grouping on a categorical, the last group may be empty.

@jreback jreback added Bug Groupby Categorical Categorical Data Type labels Apr 29, 2015
@jreback jreback added this to the 0.16.1 milestone Apr 29, 2015
@jreback
Copy link
Contributor

jreback commented Apr 29, 2015

looks good, ping when green.

shoyer added a commit that referenced this pull request Apr 29, 2015
BUG: null group spills into final group when grouping on a categorical
@shoyer shoyer merged commit 7eb5668 into pandas-dev:master Apr 29, 2015
@shoyer
Copy link
Member

shoyer commented Apr 29, 2015

thanks @evanpw !

@evanpw
Copy link
Contributor Author

evanpw commented Apr 29, 2015

Thanks!

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

Successfully merging this pull request may close these issues.

3 participants