Skip to content

Commit 425c2fb

Browse files
jbrockmendeljreback
authored andcommitted
PERF: cache IntervalIndex._ndarray_values (#30797)
1 parent cea6853 commit 425c2fb

File tree

1 file changed

+7
-17
lines changed

1 file changed

+7
-17
lines changed

pandas/core/indexes/interval.py

+7-17
Original file line numberDiff line numberDiff line change
@@ -187,16 +187,7 @@ def func(intvidx_self, other, sort=False):
187187
)
188188
@accessor.delegate_names(
189189
delegate=IntervalArray,
190-
accessors=[
191-
"_ndarray_values",
192-
"length",
193-
"size",
194-
"left",
195-
"right",
196-
"mid",
197-
"closed",
198-
"dtype",
199-
],
190+
accessors=["length", "size", "left", "right", "mid", "closed", "dtype"],
200191
typ="property",
201192
overwrite=True,
202193
)
@@ -213,7 +204,11 @@ def func(intvidx_self, other, sort=False):
213204
typ="method",
214205
overwrite=True,
215206
)
216-
@inherit_names(["is_non_overlapping_monotonic", "mid"], IntervalArray, cache=True)
207+
@inherit_names(
208+
["is_non_overlapping_monotonic", "mid", "_ndarray_values"],
209+
IntervalArray,
210+
cache=True,
211+
)
217212
class IntervalIndex(IntervalMixin, ExtensionIndex, accessor.PandasDelegate):
218213
_typ = "intervalindex"
219214
_comparables = ["name"]
@@ -225,12 +220,7 @@ class IntervalIndex(IntervalMixin, ExtensionIndex, accessor.PandasDelegate):
225220
# Immutable, so we are able to cache computations like isna in '_mask'
226221
_mask = None
227222

228-
_raw_inherit = {
229-
"_ndarray_values",
230-
"__array__",
231-
"overlaps",
232-
"contains",
233-
}
223+
_raw_inherit = {"__array__", "overlaps", "contains"}
234224

235225
# --------------------------------------------------------------------
236226
# Constructors

0 commit comments

Comments
 (0)