-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
REF: Refactor assert_index_equal #41980
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
Conversation
5e2197b
to
2497c79
Compare
Everything passes localy, so seems like the CI failurees are unrelated. |
if check_categorical: | ||
assert_attr_equal("dtype", left, right, obj=obj) | ||
if is_categorical_dtype(left.dtype) and is_categorical_dtype(right.dtype): | ||
if is_categorical_dtype(left.dtype) and is_categorical_dtype(right.dtype): |
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.
did this change any tests?
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.
I don't think so, right now. I think comparing dtype and inferred_type gives the same result for other dtypes that categoricals and numeric dtypes.
After #41153 we'll have int32 etc. dtypes, so then we'll have cases where it'll fail without this change.
3c034a7
to
c34ae66
Compare
Rebased. |
thanks @topper-123 |
There are currently some issues in
_check_dtypes
inassert_index_equal
related to #41153:assert_attr_equal("dtype", left, right, obj=obj)
currently isn't run ifcheck_categorical
is False (even if the indexes are not CategoricalIndexes)assert_class_equal
withexact='equiv'
should not be restricted to accept equivalence ofInt64Index
andRangeIndex
, but should accept equivalence of all subclasses ofNumericIndex
(in preparation for ENH: NumericIndex for any numpy int/uint/float dtype #41153).So, comparing numeric indexes with
assert_index_equal(idx1, idx2, exact="equiv")
we should for otherwise equal content have:Conversely, with
exact=True
class comparison should be strict, so:This refactoring does not change behaviour in master, but will make #41153 easier.