Skip to content

Commit 11c3a08

Browse files
authored
CLN: remove _index_data (#43229)
1 parent 58059c1 commit 11c3a08

File tree

4 files changed

+1
-23
lines changed

4 files changed

+1
-23
lines changed

pandas/_libs/reduction.pyx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,6 @@ cdef class _BaseGrouper:
6464

6565
cdef inline _update_cached_objs(self, object cached_series, object cached_index,
6666
Slider islider, Slider vslider):
67-
# See the comment in indexes/base.py about _index_data.
68-
# We need this for EA-backed indexes that have a reference
69-
# to a 1-d ndarray like datetime / timedelta / period.
7067
cached_index._engine.clear_mapping()
7168
cached_index._cache.clear() # e.g. inferred_freq must go
7269
cached_series._mgr.set_values(vslider.buf)

pandas/core/indexes/base.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -639,11 +639,6 @@ def _simple_new(cls: type[_IndexT], values, name: Hashable = None) -> _IndexT:
639639

640640
result = object.__new__(cls)
641641
result._data = values
642-
# _index_data is a (temporary?) fix to ensure that the direct data
643-
# manipulation we do in `_libs/reduction.pyx` continues to work.
644-
# We need access to the actual ndarray, since we're messing with
645-
# data buffers and strides.
646-
result._index_data = values
647642
result._name = name
648643
result._cache = {}
649644
result._reset_identity()

pandas/core/indexes/extension.py

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -448,19 +448,6 @@ class NDArrayBackedExtensionIndex(ExtensionIndex):
448448

449449
_data: NDArrayBackedExtensionArray
450450

451-
@classmethod
452-
def _simple_new(
453-
cls,
454-
values: NDArrayBackedExtensionArray,
455-
name: Hashable = None,
456-
):
457-
result = super()._simple_new(values, name)
458-
459-
# For groupby perf. See note in indexes/base about _index_data
460-
result._index_data = values._ndarray
461-
462-
return result
463-
464451
def _get_engine_target(self) -> np.ndarray:
465452
return self._data._ndarray
466453

pandas/tests/arithmetic/test_object.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,6 @@ class MyIndex(pd.Index):
341341
def _simple_new(cls, values, name=None, dtype=None):
342342
result = object.__new__(cls)
343343
result._data = values
344-
result._index_data = values
345344
result._name = name
346345
result._calls = 0
347346
result._reset_identity()
@@ -350,7 +349,7 @@ def _simple_new(cls, values, name=None, dtype=None):
350349

351350
def __add__(self, other):
352351
self._calls += 1
353-
return self._simple_new(self._index_data)
352+
return self._simple_new(self._data)
354353

355354
def __radd__(self, other):
356355
return self.__add__(other)

0 commit comments

Comments
 (0)