-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
DOC: Improved doc for Index.equals
#33289
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
DOC: Improved doc for Index.equals
#33289
Conversation
pandas/core/indexes/base.py
Outdated
>>> idx1.equals(pd.Index([1, 2, 3])) | ||
True | ||
|
||
The dtype is been compared as well |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is been
-> is
pandas/core/indexes/base.py
Outdated
>>> idx1.equals(idx2) | ||
False | ||
|
||
The oreder is also been compared |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oreder is also been compared
-> order is also compared
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While you are at it, can you also add a "Parameters" section?
pandas/core/indexes/base.py
Outdated
""" | ||
Determine if two Index objects contain the same elements. | ||
Determine if two Index objects contain the same elements with the same order. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or we could also simplify "... contain the same elements with the same order" to "... are equal" ?
We can in a second paragraph detail on what is considered as equal
pandas/core/indexes/base.py
Outdated
>>> idx1.equals(pd.Index([1, 2, 3])) | ||
True | ||
|
||
The dtype is been compared as well |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The dtype is actually not compared:
In [9]: pd.Int64Index([1, 2, 3]).equals(pd.UInt64Index([1, 2, 3]))
Out[9]: True
(in your example here, the values are not equal as a string is not equal to an integer)
Co-Authored-By: Joris Van den Bossche <[email protected]>
Thanks! |
black pandas
git diff upstream/master -u -- "*.py" | flake8 --diff