-
-
Couldn't load subscription status.
- Fork 19.2k
DEPR: Remove NumericIndex #51139
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 #51139
Changes from all commits
f2708aa
b6a1567
a972196
06ee2b3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -317,7 +317,6 @@ class Index(IndexOpsMixin, PandasObject): | |
| DatetimeIndex : Index of datetime64 data. | ||
| TimedeltaIndex : Index of timedelta64 data. | ||
| PeriodIndex : Index of Period data. | ||
| NumericIndex : Index of numpy int/uint/float data. | ||
|
|
||
| Notes | ||
| ----- | ||
|
|
@@ -539,7 +538,6 @@ def __new__( | |
|
|
||
| klass = cls._dtype_to_subclass(arr.dtype) | ||
|
|
||
| # _ensure_array _may_ be unnecessary once NumericIndex etc are gone | ||
| arr = klass._ensure_array(arr, arr.dtype, copy=False) | ||
| return klass._simple_new(arr, name) | ||
|
|
||
|
|
@@ -596,18 +594,11 @@ def _dtype_to_subclass(cls, dtype: DtypeObj): | |
|
|
||
| return TimedeltaIndex | ||
|
|
||
| elif dtype.kind in ["i", "f", "u"]: | ||
| from pandas.core.api import NumericIndex | ||
|
|
||
| return NumericIndex | ||
|
|
||
| elif dtype.kind == "O": | ||
| # NB: assuming away MultiIndex | ||
| return Index | ||
|
|
||
| elif issubclass( | ||
| dtype.type, (str, bool, np.bool_, complex, np.complex64, np.complex128) | ||
| ): | ||
| elif issubclass(dtype.type, str) or is_numeric_dtype(dtype): | ||
| return Index | ||
|
|
||
| raise NotImplementedError(dtype) | ||
|
|
@@ -1207,10 +1198,6 @@ def __repr__(self) -> str_t: | |
| Return a string representation for this object. | ||
| """ | ||
| klass_name = type(self).__name__ | ||
| from pandas.core.indexes.numeric import NumericIndex | ||
|
|
||
| if type(self) is NumericIndex: | ||
| klass_name = "Index" | ||
| data = self._format_data() | ||
| attrs = self._format_attrs() | ||
| space = self._format_space() | ||
|
|
@@ -5375,6 +5362,7 @@ def identical(self, other) -> bool: | |
| for c in self._comparables | ||
| ) | ||
| and type(self) == type(other) | ||
| and self.dtype == other.dtype | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Previously the index type could differentiate e.g. |
||
| ) | ||
|
|
||
| @final | ||
|
|
||
This file was deleted.
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.
It's not unnecessary?
Uh oh!
There was an error while loading. Please reload this page.
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 had to remove “NumericIndex” and had to decide what to do with comment and opted to delete it. IMO _ensure_array could be refactored, but so could a lot of other things in pandas and _ensure_array is not that bad anymore compared to other things, so doesn’t merit a comment In the code base IMO.
This was my reasoning, others could of course have made a different judgement call…So it’s not a strong opinion, and I’m fine with it being refactored, but also it not being refactored :-)
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.
Yeah no worries, just wasn't sure if this was still being True or not