- if not (x or y):
- x, y = index_dims[:2] if len(index_dims) > 1 else dims[:2]
- elif x and not y:
- y = [d for d in dims if d != x][0]
- elif y and not x:
- x = [d for d in dims if d != y][0]
- if (len(dims) > 2 and kind not in ('table', 'dataset') and not groupby):
- dims = list(data.coords[x].dims) + list(data.coords[y].dims)
- groupby = [d for d in index_dims if d not in (x, y) and d not in dims and d not in other_dims]