Skip to content

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

Merged
merged 14 commits into from
May 18, 2021
Merged

Conversation

jbrockmendel
Copy link
Member

This gets rid of _make_codes, which sets two state variables, in favor of a cache_readonly _codes_and_uniques

cat = self.grouper
return cat.codes
if self._codes is not None:
# set in __init__
Copy link
Member

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?

Copy link
Member Author

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

@jreback jreback added this to the 1.3 milestone May 18, 2021
@jreback jreback added the Refactor Internal refactoring of code label May 18, 2021
@jreback
Copy link
Contributor

jreback commented May 18, 2021

sure, not sure if need to rebase as merged a couple of other refactors but prob can't hurt

@jbrockmendel
Copy link
Member Author

rebased + green

@jreback jreback merged commit 20681c9 into pandas-dev:master May 18, 2021
@jbrockmendel jbrockmendel deleted the ref-grouper-3 branch May 18, 2021 22:43
TLouf pushed a commit to TLouf/pandas that referenced this pull request Jun 1, 2021
JulianWgs pushed a commit to JulianWgs/pandas that referenced this pull request Jul 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Groupby Refactor Internal refactoring of code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants