Skip to content

PERF: CategoricalIndex.get_indexer #42270

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
Jun 28, 2021
Merged

Conversation

jbrockmendel
Copy link
Member

import pandas as pd
import string, itertools
data_unique = pd.CategoricalIndex(
            ["".join(perm) for perm in itertools.permutations(string.printable, 3)]
)
cat_list = ["a", "c"]

%timeit data_unique.get_indexer(cat_list)
106 µs ± 6.14 µs per loop (mean ± std. dev. of 7 runs, 10000 loops each)  # <- PR
39 ms ± 616 µs per loop (mean ± std. dev. of 7 runs, 10 loops each)  # <- 1.2.4
290 ms ± 3.9 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)  # <- master

@jreback jreback added Index Related to the Index class or subclasses Performance Memory or execution speed performance labels Jun 28, 2021
@jreback jreback modified the milestones: 1.4, 1.3 Jun 28, 2021
@jreback jreback merged commit 73ed010 into pandas-dev:master Jun 28, 2021
@lumberbot-app

This comment has been minimized.

@jreback
Copy link
Contributor

jreback commented Jun 28, 2021

@meeseeksdev backport 1.3.x

@jreback
Copy link
Contributor

jreback commented Jun 28, 2021

cc @jbrockmendel guess this won't backport easily

@lumberbot-app

This comment has been minimized.

jbrockmendel added a commit to jbrockmendel/pandas that referenced this pull request Jun 28, 2021
simonjayhawkins pushed a commit that referenced this pull request Jun 28, 2021
* Backport PR #42270: PERF: CategoricalIndex.get_indexer

* port _maybe_cast_listlike_indexer
JulianWgs pushed a commit to JulianWgs/pandas that referenced this pull request Jul 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Index Related to the Index class or subclasses Performance Memory or execution speed performance
Projects
None yet
Development

Successfully merging this pull request may close these issues.

PERF: regression in CategoricalIndex.get_indexer
3 participants