-
-
Notifications
You must be signed in to change notification settings - Fork 18.6k
BUG: Inconsistent behavior in Index.difference #35231
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
BUG: Inconsistent behavior in Index.difference #35231
Conversation
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.
Generally this looks good to me.
But can you check how well Float64Index equals
is covered in the tests?
For example, you added an assert that floats and strings are not equal, but if we preserve behaviour, we should ensure that float / ints and float / object ints keep evaluating to True:
In [18]: pd.Index([1, 2]).equals(pd.Index([1., 2.]))
Out[18]: True
In [20]: pd.Index([1, 2]).equals(pd.Index([1., 2.], dtype=object))
Out[20]: True
(both of those will work fine as well with the new implementaiton, I think (since array_equivalent right now doesn't check the exact dtype for those, only equality), but just want to ensure it is tested)
Thanks @jorisvandenbossche for reviewing this. have extended an existing test |
pandas/tests/indexes/test_numeric.py
Outdated
|
||
i2 = Float64Index([1.0, np.nan]) | ||
assert i.equals(i2) | ||
i4 = Float64Index([1.0, np.nan]) |
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.
possible to paramaterize?
|
||
def test_float64_index_equals(): | ||
# https://github.com/pandas-dev/pandas/issues/35217 | ||
float_index = pd.Index([1.0, 2, 3]) |
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.
ideally parameterize
|
||
def test_float64_index_difference(): | ||
# https://github.com/pandas-dev/pandas/issues/35217 | ||
float_index = pd.Index([1.0, 2, 3]) |
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.
same
@simonjayhawkins are you able to update here? |
i've parameterised the additional tests added in response to #35231 (review) not sure parameterise makes sense for the issue regression tests (parameterise on have pushed changes but not yet appearing here. |
The changes are now showing, but ci not running. |
azure and travis triggered, but not github actions. will push another empty commit later if github actions doesn't run. |
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.
All green.
lgtm. can merge on green. |
black pandas
git diff upstream/master -u -- "*.py" | flake8 --diff