Skip to content

PERF: DataFrame.loc and Series.loc when key is a MultiIndex #56062

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 3 commits into from
Nov 19, 2023

Conversation

lukemanley
Copy link
Member

Avoid hitting MultiIndex.values in is_bool_indexer.

from asv_bench.benchmarks.indexing import MultiIndexing
b = MultiIndexing()
b.setup(True)
%timeit b.time_loc_multiindex(True)

# 53.3 ms ± 2.18 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)   # <- main
# 28.6 ms ± 821 µs per loop (mean ± std. dev. of 7 runs, 10 loops each)  # <- PR

@lukemanley lukemanley added Performance Memory or execution speed performance MultiIndex labels Nov 19, 2023
@lukemanley lukemanley added this to the 2.2 milestone Nov 19, 2023
@phofl phofl merged commit 6e5e393 into pandas-dev:main Nov 19, 2023
@phofl
Copy link
Member

phofl commented Nov 19, 2023

thx @lukemanley

@lukemanley lukemanley deleted the loc-with-multiindex branch November 22, 2023 01:59
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.

2 participants