diff --git a/py-polars/polars/dataframe/group_by.py b/py-polars/polars/dataframe/group_by.py index 0687313b844f..bce5dd09d813 100644 --- a/py-polars/polars/dataframe/group_by.py +++ b/py-polars/polars/dataframe/group_by.py @@ -100,7 +100,7 @@ def __iter__(self) -> Self: .group_by(*self.by, **self.named_by, maintain_order=self.maintain_order) .agg(F.first().agg_groups().alias(temp_col)) .collect(no_optimization=True) - ) + ).rechunk() self._group_names = groups_df.select(F.all().exclude(temp_col)).iter_rows() self._group_indices = groups_df.select(temp_col).to_series()