diff --git a/pandas/_libs/reduction.pyx b/pandas/_libs/reduction.pyx index c3faa00dce4c7..77fd4d94d05ac 100644 --- a/pandas/_libs/reduction.pyx +++ b/pandas/_libs/reduction.pyx @@ -64,9 +64,6 @@ cdef class _BaseGrouper: cdef inline _update_cached_objs(self, object cached_series, object cached_index, Slider islider, Slider vslider): - # See the comment in indexes/base.py about _index_data. - # We need this for EA-backed indexes that have a reference - # to a 1-d ndarray like datetime / timedelta / period. cached_index._engine.clear_mapping() cached_index._cache.clear() # e.g. inferred_freq must go cached_series._mgr.set_values(vslider.buf) diff --git a/pandas/core/indexes/base.py b/pandas/core/indexes/base.py index e5f12ec53a6d4..8bba6e46ba51d 100644 --- a/pandas/core/indexes/base.py +++ b/pandas/core/indexes/base.py @@ -638,11 +638,6 @@ def _simple_new(cls: type[_IndexT], values, name: Hashable = None) -> _IndexT: result = object.__new__(cls) result._data = values - # _index_data is a (temporary?) fix to ensure that the direct data - # manipulation we do in `_libs/reduction.pyx` continues to work. - # We need access to the actual ndarray, since we're messing with - # data buffers and strides. - result._index_data = values result._name = name result._cache = {} result._reset_identity() diff --git a/pandas/core/indexes/extension.py b/pandas/core/indexes/extension.py index b835b79b1e3e2..83a00ffcd88fc 100644 --- a/pandas/core/indexes/extension.py +++ b/pandas/core/indexes/extension.py @@ -464,19 +464,6 @@ class NDArrayBackedExtensionIndex(ExtensionIndex): _data: NDArrayBackedExtensionArray - @classmethod - def _simple_new( - cls, - values: NDArrayBackedExtensionArray, - name: Hashable = None, - ): - result = super()._simple_new(values, name) - - # For groupby perf. See note in indexes/base about _index_data - result._index_data = values._ndarray - - return result - def _get_engine_target(self) -> np.ndarray: return self._data._ndarray diff --git a/pandas/tests/arithmetic/test_object.py b/pandas/tests/arithmetic/test_object.py index 1961a2d9d89f8..9a586fd553428 100644 --- a/pandas/tests/arithmetic/test_object.py +++ b/pandas/tests/arithmetic/test_object.py @@ -341,7 +341,6 @@ class MyIndex(pd.Index): def _simple_new(cls, values, name=None, dtype=None): result = object.__new__(cls) result._data = values - result._index_data = values result._name = name result._calls = 0 result._reset_identity() @@ -350,7 +349,7 @@ def _simple_new(cls, values, name=None, dtype=None): def __add__(self, other): self._calls += 1 - return self._simple_new(self._index_data) + return self._simple_new(self._data) def __radd__(self, other): return self.__add__(other)