Skip to content
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

faster counts_by_id for pandas #83

Merged
merged 2 commits into from
May 8, 2024
Merged

faster counts_by_id for pandas #83

merged 2 commits into from
May 8, 2024

Conversation

jmoralez
Copy link
Member

@jmoralez jmoralez commented May 8, 2024

Uses pd.Series.value_counts(dropna=False, sort=False) instead of df.groupby(col, observed=True).size() which is over 2x faster.

Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@jmoralez jmoralez marked this pull request as ready for review May 8, 2024 18:14
@jmoralez jmoralez added the enhancement New feature or request label May 8, 2024
@jmoralez jmoralez merged commit 9eb7024 into main May 8, 2024
18 checks passed
@jmoralez jmoralez deleted the faster-idcounts branch May 8, 2024 18:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant