-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
PERF: Avoid MultiIndex conversion for IntervalIndex methods #24813
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
Comments
@jschendel I will look into this. |
Hello Do I understand correctly that slow df = pd.DataFrame(np.random.randn(500, 1000))
xx = pd.Series(100, index=df.columns)
%timeit df.mul(xx, axis=1) # 328 ms ± 12.7 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)
%timeit np.multiply(df, xx) # 935 µs ± 61.2 µs per loop (mean ± std. dev. of 7 runs, 1000 loops each) |
I'm not sure why this issue was mentioned in #30267. timings for #30267 are now comparable using master
also getting comparable timings with df.mul using master
|
Great, thank you @simonjayhawkins . I look forward for 1.1! p.s. just to make sure on 1.0.5 full dataframe multiplication is also 2-3 times slower:
Is it now comparable in master as well? |
yep, getting comparable numbers for those too.
|
Wonderful! Thanks a lot! |
I don't see the remaining ops in the checklist dispatching to MultiIndex so I think we can close this one |
There are a few
IntervalIndex
methods that convert to aMultiIndex
as an intermediate step, and then use the associatedMultiIndex
method to compute the result. This likely introduces overhead that could be avoided via a more directIntervalIndex
implementation.Methods that currently require a
MultiIndex
conversion:IntervalIndex.is_monotonic
([PERF] Get rid of MultiIndex conversion in IntervalIndex.is_monotonic methods #25820)IntervalIndex.is_monotonic_increasing
([PERF] Get rid of MultiIndex conversion in IntervalIndex.is_monotonic methods #25820)IntervalIndex.is_monotonic_decreasing
([PERF] Get rid of MultiIndex conversion in IntervalIndex.is_monotonic methods #25820)IntervalIndex.is_unique
([PERF] Get rid of MultiIndex conversion in IntervalIndex.is_unique #26391)Update: no longer existsIntervalIndex._get_loc_only_exact_matches
IntervalIndex.union
IntervalIndex.intersection
([PERF] Get rid of MultiIndex conversion in IntervalIndex.intersection #26225)IntervalIndex.difference
IntervalIndex.symmetric_difference
The text was updated successfully, but these errors were encountered: