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

Get rid of joining indices for equal axes at pandas backend #2490

Closed
dchigarev opened this issue Nov 30, 2020 · 1 comment
Closed

Get rid of joining indices for equal axes at pandas backend #2490

dchigarev opened this issue Nov 30, 2020 · 1 comment
Assignees

Comments

@dchigarev
Copy link
Collaborator

Currently, when doing binary operations and concat we're joining indices of left and right operands, however if axes are equals we can avoid joining and that will give us decent speedup:

import pandas
import numpy as np
from timeit import default_timer as timer

N = 50_000_000

ind1 = pandas.Index(np.arange(N))
ind2 = pandas.Index(np.arange(N))

t1 = timer()
if not ind1.equals(ind2):
    result = ind1.join(ind2, how="outer")
else:
    result = ind1
print("Checking for equality:", timer() - t1)  # ~ 0.1s

t1 = timer()
result = ind1.join(ind2, how="outer")
print("Do not checking for equality:", timer() - t1)  # ~ 8.3s
@anmyachev
Copy link
Collaborator

Fixed in #2378

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

No branches or pull requests

2 participants