Skip to content

PERF: unstack #43025

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 2 commits into from
Aug 18, 2021
Merged

PERF: unstack #43025

merged 2 commits into from
Aug 18, 2021

Conversation

jbrockmendel
Copy link
Member

  • closes #xxxx
  • tests added / passed
  • Ensure all linting tests pass, see here for how to run them
  • whatsnew entry

Avoids expensive get_indexer calls.

from asv_bench.benchmarks.reshape import *

self = Unstack()
self.setup("category")

%timeit self.time_full_product("category")
58.8 ms ± 1.52 ms per loop (mean ± std. dev. of 7 runs, 10 loops each)  # <- master
31.6 ms ± 1.98 ms per loop (mean ± std. dev. of 7 runs, 10 loops each)  # <- PR

@jreback jreback added Performance Memory or execution speed performance Reshaping Concat, Merge/Join, Stack/Unstack, Explode labels Aug 13, 2021
@jreback
Copy link
Contributor

jreback commented Aug 13, 2021

does this allow us to get rid of some cython code (that i wrote a long time ago) to do unstacking?

@jbrockmendel
Copy link
Member Author

does this allow us to get rid of some cython code (that i wrote a long time ago) to do unstacking?

no

@jreback jreback added this to the 1.4 milestone Aug 18, 2021
@@ -287,7 +287,7 @@ def get_new_values(self, values, fill_value=None):

return new_values, new_mask

def get_new_columns(self, value_columns):
def get_new_columns(self, value_columns: Index | None):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this still called?

@jbrockmendel
Copy link
Member Author

jbrockmendel commented Aug 18, 2021 via email

@jreback jreback merged commit bbb3cae into pandas-dev:master Aug 18, 2021
@jbrockmendel jbrockmendel deleted the perf-unstack branch August 18, 2021 23:54
feefladder pushed a commit to feefladder/pandas that referenced this pull request Sep 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Performance Memory or execution speed performance Reshaping Concat, Merge/Join, Stack/Unstack, Explode
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants