Skip to content

Commit ed15d8e

Browse files
authored
CLN: make DTA/TDA check clearer (#33665)
1 parent 7afb870 commit ed15d8e

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

pandas/core/indexes/datetimelike.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,7 @@ def wrapper(left, right):
8080
cache=True,
8181
)
8282
@inherit_names(
83-
["mean", "freq", "freqstr", "asi8", "_box_values", "_box_func"],
84-
DatetimeLikeArrayMixin,
83+
["mean", "freq", "freqstr", "asi8", "_box_func"], DatetimeLikeArrayMixin,
8584
)
8685
class DatetimeIndexOpsMixin(ExtensionIndex):
8786
"""

pandas/core/indexes/multi.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
pandas_dtype,
3838
)
3939
from pandas.core.dtypes.dtypes import ExtensionDtype
40-
from pandas.core.dtypes.generic import ABCDataFrame
40+
from pandas.core.dtypes.generic import ABCDataFrame, ABCDatetimeIndex, ABCTimedeltaIndex
4141
from pandas.core.dtypes.missing import array_equivalent, isna
4242

4343
import pandas.core.algorithms as algos
@@ -653,7 +653,9 @@ def values(self):
653653
vals = self._get_level_values(i)
654654
if is_categorical_dtype(vals):
655655
vals = vals._internal_get_values()
656-
if isinstance(vals.dtype, ExtensionDtype) or hasattr(vals, "_box_values"):
656+
if isinstance(vals.dtype, ExtensionDtype) or isinstance(
657+
vals, (ABCDatetimeIndex, ABCTimedeltaIndex)
658+
):
657659
vals = vals.astype(object)
658660
vals = np.array(vals, copy=False)
659661
values.append(vals)

0 commit comments

Comments
 (0)