diff --git a/flox/core.py b/flox/core.py index e1e7dc039..4f34c020b 100644 --- a/flox/core.py +++ b/flox/core.py @@ -1809,4 +1809,8 @@ def groupby_reduce( if _is_minmax_reduction(func) and is_bool_array: result = result.astype(bool) + # we lose dtype information when creating a pandas Index + # That's always int64 or float64, so cast back + # TODO: migrate to NumericIndex but I think this will just fix itself + groups = tuple(g.astype(b.dtype) for g, b in zip(groups, bys)) return (result, *groups)