diff --git a/pandas/core/indexes/datetimelike.py b/pandas/core/indexes/datetimelike.py index 203ea2152886a..067ff32b85862 100644 --- a/pandas/core/indexes/datetimelike.py +++ b/pandas/core/indexes/datetimelike.py @@ -80,8 +80,7 @@ def wrapper(left, right): cache=True, ) @inherit_names( - ["mean", "freq", "freqstr", "asi8", "_box_values", "_box_func"], - DatetimeLikeArrayMixin, + ["mean", "freq", "freqstr", "asi8", "_box_func"], DatetimeLikeArrayMixin, ) class DatetimeIndexOpsMixin(ExtensionIndex): """ diff --git a/pandas/core/indexes/multi.py b/pandas/core/indexes/multi.py index d411867af2ef8..ce5008630e53d 100644 --- a/pandas/core/indexes/multi.py +++ b/pandas/core/indexes/multi.py @@ -37,7 +37,7 @@ pandas_dtype, ) from pandas.core.dtypes.dtypes import ExtensionDtype -from pandas.core.dtypes.generic import ABCDataFrame +from pandas.core.dtypes.generic import ABCDataFrame, ABCDatetimeIndex, ABCTimedeltaIndex from pandas.core.dtypes.missing import array_equivalent, isna import pandas.core.algorithms as algos @@ -653,7 +653,9 @@ def values(self): vals = self._get_level_values(i) if is_categorical_dtype(vals): vals = vals._internal_get_values() - if isinstance(vals.dtype, ExtensionDtype) or hasattr(vals, "_box_values"): + if isinstance(vals.dtype, ExtensionDtype) or isinstance( + vals, (ABCDatetimeIndex, ABCTimedeltaIndex) + ): vals = vals.astype(object) vals = np.array(vals, copy=False) values.append(vals)