-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
DEPR: Remove NumericIndex from pandas/_testing/ #51098
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
DEPR: Remove NumericIndex from pandas/_testing/ #51098
Conversation
isn't there a keyword for this? |
IMO I think int32/int16/int8 indexes should probably be considered equal to RangeIndex if the values appear equivalent, but probably better discussed & maybe addressed in a follow up |
I don't think so. There is |
In assert_index_equal we have 'exact' for allowing an Int64Index to be close enough to a RangeIndex. That can't be repurposed? |
ATM we have: >>> x1 = pd.Index([1, 2, 3], dtype="int8")
>>> x2 = pd.Index([1, 2, 3], dtype="int32")
>>> tm.assert_index_equal(x1, x2)
AssertionError: Index are different
Attribute "dtype" are different
[left]: int32
[right]: int8 If your suggestion should be implemented, the above assertion should also be able to pass IMO, do we want that? Then what about |
I'm not sure I understand you here, could you expand? This is about the functionality of |
without a keyword, assert_foo_equal should require dtypes to match |
A new keyword or an added option to As an aside, I would like the default value for |
Definitely not a new keyword. I was mostly just observing that the "exact" keyword was intended to allow case 2 from the OP to be equal-enough for assert_index_equal.
+1 |
Yeah I would expect
|
I (and I think topper) disagree with mroeschke on the Index[int16]-vs-RangeIndex case. I think we should be maximally-strict and have that raise. (if down the line the default for 'exact' is changed from "equiv" to True, then id be open to allowing that to not-raise) |
Yeah, I agree with @jbrockmendel on this. |
1 similar comment
Yeah, I agree with @jbrockmendel on this. |
Okay that's fair; my opinion isn't super strong (FWIW I'm not super fond of having |
so are we good to merge? |
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.
LGTM
Thanks @topper-123 |
Removes
NumericIndex
frompandas._testing
.A decision has to be made how
assert_index_equal
should interpret equivalence between an index and aRangeIndex
. IMO two indexes should be equivalent if they both return true for one of the two tests below:The first is easy to agree on, but notice that the second means that an
Index
subclass with int64 dtype will not be equivalent to aRangeIndex
. My thinking is that if the user subclassesIndex
, then subclass instances shouldn't be equivalent toRangeIndex
, even if it has a int64 dtype.Also, int32/int16/int8 indexes won't be equivalent to
RangeIndex
in this implementation.