We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent a0ab10f commit 723e19bCopy full SHA for 723e19b
xarray/core/groupby.py
@@ -426,12 +426,16 @@ def factorize(self) -> EncodedGroups:
426
)
427
dim_name = "stacked_" + "_".join(str(grouper.name) for grouper in groupers)
428
429
+ coords = Coordinates.from_pandas_multiindex(midx, dim=dim_name)
430
+ for grouper in groupers:
431
+ coords.variables[grouper.name].attrs = grouper.group.attrs
432
+
433
return EncodedGroups(
434
codes=first_codes.copy(data=_flatcodes),
435
full_index=full_index,
436
group_indices=_codes_to_group_indices(_flatcodes.ravel(), len(full_index)),
437
unique_coord=Variable(dims=(dim_name,), data=midx.values),
- coords=Coordinates.from_pandas_multiindex(midx, dim=dim_name),
438
+ coords=coords,
439
440
441
0 commit comments