Skip to content

Fixed reindexing arith with duplicates #35303

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 1 commit into from
Jul 16, 2020

Conversation

TomAugspurger
Copy link
Contributor

@TomAugspurger TomAugspurger commented Jul 16, 2020

Closes #35194

Still need to run ASV on this. This was a regression from 0.25.x to 1.0. It doesn't have to go in 1.1, but probably better for 1.1.0.rc0 than a 1.1.1 release.

@TomAugspurger
Copy link
Contributor Author

cc @jbrockmendel.

@TomAugspurger TomAugspurger added the Numeric Operations Arithmetic, Comparison, and Logical operations label Jul 16, 2020
@jreback jreback added the Indexing Related to indexing on series/frames, not to indexes themselves label Jul 16, 2020
@jreback jreback added this to the 1.1 milestone Jul 16, 2020
Copy link
Contributor

@jreback jreback left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep this is ok

@TomAugspurger
Copy link
Contributor Author

Having trouble with ASV right now. Things seem OK in this small benchmark though

In [15]: df1 = pd.DataFrame(np.random.randn(1000, 500))

In [16]: df2 = pd.DataFrame(np.random.randn(1000, 501))

In [17]: %timeit df1 + df2
# master
3.8 ms ± 115 µs per loop (mean ± std. dev. of 7 runs, 100 loops each)

# PR
3.77 ms ± 104 µs per loop (mean ± std. dev. of 7 runs, 100 loops each)

# https://github.com/pandas-dev/pandas/issues/35194
indexer, _ = result.columns.get_indexer_non_unique(join_columns)
indexer = algorithms.unique1d(indexer)
result = result._reindex_with_indexers(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there a public method that could be used here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not that I know of.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we do this type of thing in indexing.py, so should try to refactor later

@jbrockmendel
Copy link
Member

LGTM

@jreback jreback merged commit d396111 into pandas-dev:master Jul 16, 2020
@jreback
Copy link
Contributor

jreback commented Jul 16, 2020

thanks @TomAugspurger

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Indexing Related to indexing on series/frames, not to indexes themselves Numeric Operations Arithmetic, Comparison, and Logical operations
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: Adding two DataFrames together with duplicate column names in one results in infinite loop
3 participants