Skip to content

PERF: MultiIndex.get_loc #29469

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 1 commit into from
Nov 7, 2019
Merged

Conversation

jbrockmendel
Copy link
Member

In [4]: mi_med = pd.MultiIndex.from_product( 
    ...:     [np.arange(1000), np.arange(10), list("A")], names=["one", "two", "three"] 
    ...: ) 

In [5]: %timeit mi_med.get_loc((999, 9, "A"))   
master --> 42.6 µs ± 411 ns per loop (mean ± std. dev. of 7 runs, 10000 loops each)
PR     --> 11.4 µs ± 120 ns per loop (mean ± std. dev. of 7 runs, 100000 loops each)

Copy link
Contributor

@topper-123 topper-123 left a comment

Choose a reason for hiding this comment

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

Nice. Did you look into the _set_names issue that was discussed? That could be a possible further improvement.

@topper-123 topper-123 added MultiIndex Performance Memory or execution speed performance labels Nov 7, 2019
@topper-123 topper-123 added this to the 1.0 milestone Nov 7, 2019
@jreback jreback merged commit a109a5d into pandas-dev:master Nov 7, 2019
@jbrockmendel jbrockmendel deleted the perf-nlevels branch November 7, 2019 21:56
Reksbril pushed a commit to Reksbril/pandas that referenced this pull request Nov 18, 2019
proost pushed a commit to proost/pandas that referenced this pull request Dec 19, 2019
proost pushed a commit to proost/pandas that referenced this pull request Dec 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
MultiIndex Performance Memory or execution speed performance
Projects
None yet
Development

Successfully merging this pull request may close these issues.

PERF: regression in MultiIndex get_loc indexing performance
3 participants