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

Projects
None yet
3 participants
@TomAugspurger
Copy link
Contributor

commented Nov 30, 2018

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
@pep8speaks

This comment has been minimized.

Copy link

commented Nov 30, 2018

Hello @TomAugspurger! Thanks for submitting the PR.

TomAugspurger added some commits Nov 30, 2018

@codecov

This comment has been minimized.

Copy link

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 referenced this pull request Nov 30, 2018

Merged

REF: DatetimeLikeArray #24024

7 of 12 tasks complete

@jreback jreback merged commit 6194b63 into pandas-dev:master Nov 30, 2018

3 checks passed

ci/circleci Your tests passed on CircleCI!
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
pandas-dev.pandas Build #20181130.40 succeeded
Details
@jreback

This comment has been minimized.

Copy link
Contributor

commented Nov 30, 2018

thanks!

saurav2608 added a commit to saurav2608/pandas that referenced this pull request Dec 1, 2018

Pingviinituutti added a commit to Pingviinituutti/pandas that referenced this pull request Feb 28, 2019

Pingviinituutti added 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
You can’t perform that action at this time.