Skip to content
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

PERF: Use Categorical.equals in CategoricalIndex.equals #24023

Merged
merged 3 commits into from
Nov 30, 2018

Conversation

TomAugspurger
Copy link
Contributor

Avoids a materialization of the full array.

import pandas as pd
import numpy as np
import string


a = pd.CategoricalIndex(np.random.choice(list(string.ascii_letters[:10]), 100_000))
b = a.copy()
c = pd.CategoricalIndex(np.random.choice(list(string.ascii_letters[:10]), 100_000))

print("eq-index")
%timeit a.equals(b)

print("ne-index")
%timeit a.equals(c)

timings

case master pr
eq-index 3.35 ms 420 µs
ne-index 1.29 ms 451 µs

@TomAugspurger TomAugspurger added Performance Memory or execution speed performance Categorical Categorical Data Type labels Nov 30, 2018
@TomAugspurger TomAugspurger added this to the 0.24.0 milestone Nov 30, 2018
@pep8speaks
Copy link

Hello @TomAugspurger! Thanks for submitting the PR.

@codecov
Copy link

codecov bot commented Nov 30, 2018

Codecov Report

Merging #24023 into master will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #24023      +/-   ##
==========================================
+ Coverage   92.31%   92.31%   +<.01%     
==========================================
  Files         161      161              
  Lines       51549    51551       +2     
==========================================
+ Hits        47586    47588       +2     
  Misses       3963     3963
Flag Coverage Δ
#multiple 90.71% <100%> (ø) ⬆️
#single 42.45% <100%> (ø) ⬆️
Impacted Files Coverage Δ
pandas/core/indexes/category.py 97.88% <100%> (+0.01%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update dc8d35a...f35e8dd. Read the comment docs.

@TomAugspurger TomAugspurger mentioned this pull request Nov 30, 2018
12 tasks
@jreback jreback merged commit 6194b63 into pandas-dev:master Nov 30, 2018
@jreback
Copy link
Contributor

jreback commented Nov 30, 2018

thanks!

saurav2608 pushed a commit to saurav2608/pandas that referenced this pull request Dec 1, 2018
Pingviinituutti pushed a commit to Pingviinituutti/pandas that referenced this pull request Feb 28, 2019
Pingviinituutti pushed a commit to Pingviinituutti/pandas that referenced this pull request Feb 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Categorical Categorical Data Type Performance Memory or execution speed performance
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants