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/1569#issuecomment-1094066748,https://api.github.com/repos/pydata/xarray/issues/1569,1094066748,IC_kwDOAMm_X85BNiI8,5635139,2022-04-09T15:25:06Z,2022-04-09T15:25:06Z,MEMBER,"The example above is now fixed: ```python In [1]: ds=xr.Dataset(dict(a=(('z',), np.ones(10))), coords=dict(b=(('z'),np.arange(2).repeat(5)), c=(('z'),np.arange(5).repeat(2)))) ...: In [2]: ds.set_index(bc=['b','c']).groupby('bc').sum() Out[2]: Dimensions: (bc: 6, z: 10) Coordinates: * bc (bc) object MultiIndex * b (bc) int64 0 0 0 1 1 1 * c (bc) int64 0 1 2 2 3 4 Dimensions without coordinates: z Data variables: a (bc, z) float64 1.0 1.0 1.0 1.0 1.0 1.0 ... 1.0 1.0 1.0 1.0 1.0 1.0 # <- correct ```","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,257070215 https://github.com/pydata/xarray/issues/1569#issuecomment-393345152,https://api.github.com/repos/pydata/xarray/issues/1569,393345152,MDEyOklzc3VlQ29tbWVudDM5MzM0NTE1Mg==,5635139,2018-05-30T22:52:38Z,2018-05-30T22:52:38Z,MEMBER,"Are we making silent mistakes at the moment? ```python In [1]: import xarray as xr In [2]: import pandas as pd In [4]: import numpy as np In [5]: ds=xr.Dataset(dict(a=(('z',), np.ones(10))), coords=dict(b=(('z'),np.arange(2).repeat(5)), c=(('z'),np.arange(5).repeat(2)))) In [6]: ds Out[6]: Dimensions: (z: 10) Coordinates: b (z) int64 0 0 0 0 0 1 1 1 1 1 c (z) int64 0 0 1 1 2 2 3 3 4 4 Dimensions without coordinates: z Data variables: a (z) float64 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 In [7]: ds.set_index(bc=['b','c']).groupby('bc').sum() Out[7]: Dimensions: (bc: 6) Coordinates: * bc (bc) MultiIndex - bc_level_0 (bc) int64 0 0 0 1 1 1 - bc_level_1 (bc) int64 0 1 2 2 3 4 Data variables: a (bc) float64 10.0 10.0 10.0 10.0 10.0 10.0 # <--- this is wrong? ``` With a `DataArray`, we do raise: ```python In [19]: ds['a'].set_index(bc=['b','c']) Out[19]: array([1., 1., 1., 1., 1., 1., 1., 1., 1., 1.]) Coordinates: * bc (bc) MultiIndex - b (bc) int64 0 0 0 0 0 1 1 1 1 1 - c (bc) int64 0 0 1 1 2 2 3 3 4 4 Dimensions without coordinates: z In [20]: ds['a'].set_index(bc=['b','c']).groupby('bc') --------------------------------------------------------------------------- KeyError Traceback (most recent call last) in () ----> 1 ds['a'].set_index(bc=['b','c']).groupby('bc') /usr/local/lib/python3.6/site-packages/xarray/core/common.py in groupby(self, group, squeeze) 472 core.groupby.DatasetGroupBy 473 """""" --> 474 return self._groupby_cls(self, group, squeeze=squeeze) 475 476 def groupby_bins(self, group, bins, right=True, labels=None, precision=3, /usr/local/lib/python3.6/site-packages/xarray/core/groupby.py in __init__(self, obj, group, squeeze, grouper, bins, cut_kwargs) 213 group_dim, = group.dims 214 --> 215 expected_size = obj.sizes[group_dim] 216 if group.size != expected_size: 217 raise ValueError('the group variable\'s length does not ' /usr/local/lib/python3.6/site-packages/xarray/core/utils.py in __getitem__(self, key) 306 307 def __getitem__(self, key): --> 308 return self.mapping[key] 309 310 def __iter__(self): KeyError: 'bc' ```","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,257070215 https://github.com/pydata/xarray/issues/1569#issuecomment-328969009,https://api.github.com/repos/pydata/xarray/issues/1569,328969009,MDEyOklzc3VlQ29tbWVudDMyODk2OTAwOQ==,1217238,2017-09-12T20:05:39Z,2017-09-12T20:05:39Z,MEMBER,"The ""Edit on GitHub"" link at the top right of doc page is probably the most convenient way for primary doc pages. It should walk you through making a pull request if you hit the ""Edit this file"" icon (next to the trash bin) at the top right of the file on GitHub. To clarify on `level`: it's not supported, but instead you can simply pass the name of a MultiIndex level directly as a name. Multiple arguments are truly not supported yet (https://github.com/pydata/xarray/issues/324).","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,257070215 https://github.com/pydata/xarray/issues/1569#issuecomment-328939373,https://api.github.com/repos/pydata/xarray/issues/1569,328939373,MDEyOklzc3VlQ29tbWVudDMyODkzOTM3Mw==,1217238,2017-09-12T18:21:36Z,2017-09-12T18:21:36Z,MEMBER,We should clarify: we support a subset of the pandas API. The `level` argument and grouping by multiple variables at once is not yet supported.,"{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,257070215