Skip to content

Behavior change in Index.equals from 0.18.0 to 0.19.0 -- intentional? #14411

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

Closed
njsmith opened this issue Oct 13, 2016 · 2 comments · Fixed by #27105
Closed

Behavior change in Index.equals from 0.18.0 to 0.19.0 -- intentional? #14411

njsmith opened this issue Oct 13, 2016 · 2 comments · Fixed by #27105
Labels
Docs Index Related to the Index class or subclasses
Milestone

Comments

@njsmith
Copy link

njsmith commented Oct 13, 2016

Traditionally, we have:

In [3]: pandas.__version__
Out[3]: '0.18.0'

In [4]: pandas.Index([1, 2]).equals([1, 2])
Out[4]: True

But this changed

In [4]: pandas.__version__
Out[4]: '0.19.0'

In [5]: pandas.Index([1, 2]).equals([1, 2])
Out[5]: False

Looks like it might not be intentional so FYI.

(Noticed because it broke a few tests in the patsy test suite.)

njsmith added a commit to njsmith/patsy that referenced this issue Oct 13, 2016
Traditionally, `pandas.Index([1, 2]).equals([1, 2])` returned True. In
0.19.0, it returns False, and we have to explicitly upcast the argument
to an Index to get the test we want.

pandas-dev/pandas#14411
@jorisvandenbossche
Copy link
Member

jorisvandenbossche commented Oct 13, 2016

Well, we had some discussion about this, see #13986 (comment) (I thought we had a longer discussion somewhere else, but can't find it directly), but I think I lost the discussion for allowing this.
Basically, to be equal to an index, you now have to be an index yourself (so a list can no longer be equal). But I see we didn't really explain this in the whatsnew docs.

@jorisvandenbossche jorisvandenbossche added the Indexing Related to indexing on series/frames, not to indexes themselves label Oct 13, 2016
@njsmith
Copy link
Author

njsmith commented Oct 13, 2016

I can see the argument for the new behavior, but it was a backwards incompatible change with no deprecation, so wasn't sure what was going on.

I've already worked around it for patsy.

@toobaz toobaz added Index Related to the Index class or subclasses Docs and removed Indexing Related to indexing on series/frames, not to indexes themselves labels Jun 28, 2019
toobaz added a commit to toobaz/pandas that referenced this issue Jun 28, 2019
@jreback jreback added this to the 0.25.0 milestone Jun 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Docs Index Related to the Index class or subclasses
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants