Skip to content

PERF: IntervalArray.unique, IntervalIndex.intersection #42197

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 4 commits into from
Jun 25, 2021

Conversation

jbrockmendel
Copy link
Member

  • closes #xxxx
  • tests added / passed
  • Ensure all linting tests pass, see here for how to run them
  • whatsnew entry

Partially address perf hit discussed in #41929

import numpy as np
from pandas import *

N = 10**5

left = np.append(np.arange(N), np.array(0))
right = np.append(np.arange(1, N + 1), np.array(1))
intv = IntervalIndex.from_arrays(left, right)

intv2 = IntervalIndex.from_arrays(left + 1, right + 1)

%timeit intv.intersection(intv2)
122 ms ± 2.34 ms per loop (mean ± std. dev. of 7 runs, 10 loops each)  # <- PR
263 ms ± 5.98 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)  # <- master

xref #36482

@jreback jreback added the Interval Interval data type label Jun 25, 2021
@jreback jreback modified the milestones: 1.4, 1.3 Jun 25, 2021
@jreback jreback merged commit d61ace5 into pandas-dev:master Jun 25, 2021
meeseeksmachine pushed a commit to meeseeksmachine/pandas that referenced this pull request Jun 25, 2021
@jreback
Copy link
Contributor

jreback commented Jun 25, 2021

@meeseeksdev backport 1.3.x

@lumberbot-app
Copy link

lumberbot-app bot commented Jun 25, 2021

Something went wrong ... Please have a look at my logs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Interval Interval data type
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants