diff --git a/pandas/core/apply.py b/pandas/core/apply.py index 6302499b6d153..94b7c59b93563 100644 --- a/pandas/core/apply.py +++ b/pandas/core/apply.py @@ -13,7 +13,7 @@ is_list_like, is_sequence, ) -from pandas.core.dtypes.generic import ABCSeries +from pandas.core.dtypes.generic import ABCMultiIndex, ABCSeries if TYPE_CHECKING: from pandas import DataFrame, Series, Index @@ -281,7 +281,7 @@ def apply_standard(self): and not self.dtypes.apply(is_extension_array_dtype).any() # Disallow complex_internals since libreduction shortcut # cannot handle MultiIndex - and not self.agg_axis._has_complex_internals + and not isinstance(self.agg_axis, ABCMultiIndex) ): values = self.values diff --git a/pandas/core/indexes/base.py b/pandas/core/indexes/base.py index 20ca176f4a456..5ac361a83abd0 100644 --- a/pandas/core/indexes/base.py +++ b/pandas/core/indexes/base.py @@ -4086,11 +4086,6 @@ def _assert_can_do_op(self, value): msg = "'value' must be a scalar, passed: {0}" raise TypeError(msg.format(type(value).__name__)) - @property - def _has_complex_internals(self): - # to disable groupby tricks in MultiIndex - return False - def _is_memory_usage_qualified(self): """ Return a boolean if we need a qualified .info display. diff --git a/pandas/core/indexes/multi.py b/pandas/core/indexes/multi.py index a83fd6bf59f05..e768a5b6dd23c 100644 --- a/pandas/core/indexes/multi.py +++ b/pandas/core/indexes/multi.py @@ -1396,11 +1396,6 @@ def values(self): self._tuples = lib.fast_zip(values) return self._tuples - @property - def _has_complex_internals(self): - # to disable groupby tricks - return True - @cache_readonly def is_monotonic_increasing(self): """