-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
REF: make Grouping less stateful #41529
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
pandas/core/groupby/grouper.py
Outdated
cat = self.grouper | ||
return cat.codes | ||
if self._codes is not None: | ||
# set in __init__ |
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.
Hmm the comment here is a little confusing. So this is set in init but subsequently set to None?
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.
self._codes is set in __init__
, usually to None, but in one case to an ndarray, in which case we use that. I'll flesh out the comment
sure, not sure if need to rebase as merged a couple of other refactors but prob can't hurt |
rebased + green |
This gets rid of _make_codes, which sets two state variables, in favor of a cache_readonly _codes_and_uniques