Skip to content

Commit 8701e9b

Browse files
committed
More generalization
1 parent c452276 commit 8701e9b

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

xarray/core/groupby.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1048,10 +1048,7 @@ def quantile(
10481048
"Sample quantiles in statistical packages,"
10491049
The American Statistician, 50(4), pp. 361-365, 1996
10501050
"""
1051-
if dim is None:
1052-
self._raise_if_not_single_group()
1053-
(grouper,) = self.groupers
1054-
dim = self.group1d.dims
1051+
dim = dim or self._group_dim
10551052

10561053
# Dataset.quantile does this, do it for flox to ensure same output.
10571054
q = np.asarray(q, dtype=np.float64)
@@ -1267,9 +1264,7 @@ def _combine(self, applied, shortcut=False):
12671264
combined = self._concat_shortcut(applied, dim, positions)
12681265
else:
12691266
combined = concat(applied, dim)
1270-
self._raise_if_not_single_group()
1271-
(grouper,) = self.groupers
1272-
combined = _maybe_reorder(combined, dim, positions, N=grouper.group.size)
1267+
combined = _maybe_reorder(combined, dim, positions, N=self.group1d.size)
12731268

12741269
if isinstance(combined, type(self._obj)):
12751270
# only restore dimension order for arrays
@@ -1358,7 +1353,6 @@ class DatasetGroupByBase(GroupBy["Dataset"], DatasetGroupbyArithmetic):
13581353
@property
13591354
def dims(self) -> Frozen[Hashable, int]:
13601355
if self._dims is None:
1361-
self._raise_if_not_single_group()
13621356
index = self.encoded.group_indices[0]
13631357
self._dims = self._obj.isel({self._group_dim: index}).dims
13641358

0 commit comments

Comments
 (0)