html_url,issue_url,id,node_id,user,created_at,updated_at,author_association,body,reactions,performed_via_github_app,issue
https://github.com/pydata/xarray/issues/324#issuecomment-265462343,https://api.github.com/repos/pydata/xarray/issues/324,265462343,MDEyOklzc3VlQ29tbWVudDI2NTQ2MjM0Mw==,5629061,2016-12-07T14:35:01Z,2016-12-07T14:35:01Z,NONE,"In case it is of interest to anyone, the snippet below is a **temporary and quite dirty** solution I've used to do a multi-dimensional groupby...
It runs nested groupby-apply operations over each given dimension until no further grouping needs to be done, then applies the given function ""apply_fn""
```
def nested_groupby_apply(dataarray, groupby, apply_fn):
if len(groupby) == 1:
return dataarray.groupby(groupby[0]).apply(apply_fn)
else:
return dataarray.groupby(groupby[0]).apply(nested_groupby_apply, groupby = groupby[1:], apply_fn = apply_fn)
```
Obviously performance can potentially be quite poor. Passing the dimensions to group over in order of increasing length will reduce your cost a little.","{""total_count"": 3, ""+1"": 3, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,58117200