-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
PERF: df.groupby(categorical) #49596
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
Conversation
Wow, very nice! One question, that's only semi-related to this: why do we even use Could we get an additional perf. improvement by avoiding |
I'm going to guess the rationale for matching the original order of the categories is to keep the result categories dtype equivalent to the input categories dtype. I think we could add a short-circuit that checks to see if they happen to be equal already and if so skip |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Ok. Thanks for trying it out. This performance improvement is already really great as is :-) |
Thanks, @lukemanley. Great stuff. |
* Categorical.reorder_categories perf * whatsnew
* Categorical.reorder_categories perf * whatsnew
* Categorical.reorder_categories perf * whatsnew
doc/source/whatsnew/v2.0.0.rst
file if fixing a bug or adding a new feature.Perf improvement in
Categorical.reorder_categories
with user facing performance improvements likely to beDataFrame.groupby(categorical)
.existing ASVs: