diff --git a/pandas/core/groupby/groupby.py b/pandas/core/groupby/groupby.py index d1f51eeae1f69..67b5c483fcb97 100644 --- a/pandas/core/groupby/groupby.py +++ b/pandas/core/groupby/groupby.py @@ -5844,6 +5844,7 @@ def _wrap_idxmax_idxmin(self, res: NDFrameT) -> NDFrameT: if isinstance(index, MultiIndex): index = index.to_flat_index() values = res._values + assert isinstance(values, np.ndarray) na_value = na_value_for_dtype(index.dtype, compat=False) if isinstance(res, Series): # mypy: expression has type "Series", variable has type "NDFrameT"