-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Labels
Description
I'm working through some around non-trivial groupby from colleagues. In particular, grouping by multiple coordinates seems much harder in xarray than pandas. Flox actually does this really nicely, as per the comment from @dcherian:
As an aside, the API isn't great but this works in flox (I think)
import flox.xarray
flox.xarray.xarray_reduce(da, "labels1", "labels2", func="mean")
Originally posted by @dcherian in #9278 (comment)
Would be great if da.groupby(["labels1", "labels2"]).mean() worked too — is that just a simple translation to flox from the xarray code? (I can probably do it if so). Or is there something more complex going on?