Skip to content

REF: move IntervalIndex.equals up to ExtensionIndex.equals #37561

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
Nov 2, 2020

Conversation

jbrockmendel
Copy link
Member

No description provided.

@jreback jreback added the Interval Interval data type label Nov 2, 2020
@jreback jreback added this to the 1.2 milestone Nov 2, 2020
@jreback
Copy link
Contributor

jreback commented Nov 2, 2020

any more equals you can remove because of this? (followon)

@jreback jreback merged commit 7d2a794 into pandas-dev:master Nov 2, 2020
@jbrockmendel
Copy link
Member Author

any more equals you can remove because of this? (followon)

Not without API changes, but it may be worthwhile to get these more strict/consistent

@jbrockmendel jbrockmendel deleted the ref-ei-equals branch November 2, 2020 01:12
kesmit13 pushed a commit to kesmit13/pandas that referenced this pull request Nov 2, 2020
@jbrockmendel
Copy link
Member Author

any more equals you can remove because of this? (followon)

Not without API changes, but it may be worthwhile to get these more strict/consistent

So the least invasive would be CategoricalIndex. Changing it to match this strict version (actually just removing it) breaks 5 tests. Four of these are asserting index.equals(index.astype(object)), which we test for all Index subclasses except IntervalIndex (which suggests IntervalIndex possibly should support this)

The fifth is an indexing test that may indicate a bug elsewhere:

        df = DataFrame(np.random.randn(3, 3), index=list("ABA"), columns=list("XYX"))
        cdf = df.copy()
        cdf.index = CategoricalIndex(df.index)
        cdf.columns = CategoricalIndex(df.columns)
    
        exp_index = CategoricalIndex(list("AA"), categories=["A", "B"])
>       expect = DataFrame(df.loc["A", :], columns=cdf.columns, index=exp_index)
[...]
E           ValueError: cannot reindex from a duplicate axis

ukarroum pushed a commit to ukarroum/pandas that referenced this pull request Nov 2, 2020
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