PERF: unstack by jbrockmendel · Pull Request #43025 · pandas-dev/pandas (original) (raw)

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 andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged

PERF: unstack #43025

Conversation4 Commits2 Checks0 Files changed

Conversation

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters

[ Show hidden characters]({{ revealButtonHref }})

jbrockmendel

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

@jbrockmendel

@jbrockmendel

@jreback

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

@jbrockmendel

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

no

jreback

@@ -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):

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

Yes, just fewer times

On Wed, Aug 18, 2021 at 8:20 AM Jeff Reback ***@***.***> wrote: ***@***.**** requested changes on this pull request. ------------------------------ In pandas/core/reshape/reshape.py <#43025 (comment)>: > @@ -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): is this still called? — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub <#43025 (review)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AB5UM6E6WA7525MXYRE3WV3T5PFVRANCNFSM5CEFXWSQ> . Triage notifications on the go with GitHub Mobile for iOS <https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675> or Android <https://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email> .

jreback

feefladder pushed a commit to feefladder/pandas that referenced this pull request

Sep 7, 2021

@jbrockmendel @feefladder

Labels

Performance

Memory or execution speed performance

Reshaping

Concat, Merge/Join, Stack/Unstack, Explode

2 participants

@jbrockmendel @jreback