Skip to content

PERF: groupby.apply on a non-unique, unsorted index #47234

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

Conversation

lukemanley
Copy link
Member

Added the following asv to cover this case:

from asv_bench.benchmarks.groupby import ApplyNonUniqueUnsortedIndex

b = ApplyNonUniqueUnsortedIndex()
b.setup()

%timeit b.time_groupby_apply_non_unique_unsorted_index()
2.16 s ± 163 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)     <- main
7.1 ms ± 207 µs per loop (mean ± std. dev. of 7 runs, 100 loops each)  <- PR

@lukemanley lukemanley added Performance Memory or execution speed performance Groupby labels Jun 4, 2022
@jreback jreback added this to the 1.5 milestone Jun 5, 2022
@jreback jreback merged commit c5e32b5 into pandas-dev:main Jun 5, 2022
@jreback
Copy link
Contributor

jreback commented Jun 5, 2022

thanks @lukemanley very nice!

yehoshuadimarsky pushed a commit to yehoshuadimarsky/pandas that referenced this pull request Jul 13, 2022
@lukemanley lukemanley deleted the groupby-apply-non-unique-unsorted-index branch September 10, 2022 00:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Groupby Performance Memory or execution speed performance
Projects
None yet
Development

Successfully merging this pull request may close these issues.

PERF: groupby on an unsorted index slows to a crawl. works fine if index is sorted.
2 participants