From c061e6a006e26a3473841ca051abdbd63a0b51b1 Mon Sep 17 00:00:00 2001 From: Deepak Cherian Date: Fri, 21 Jun 2024 15:42:54 -0600 Subject: [PATCH] fix types. --- xarray/core/dataarray.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/xarray/core/dataarray.py b/xarray/core/dataarray.py index e6ca2ef773b..bd2781e8c76 100644 --- a/xarray/core/dataarray.py +++ b/xarray/core/dataarray.py @@ -6772,14 +6772,18 @@ def groupby( _validate_groupby_squeeze(squeeze) + grouper: Grouper if group is not None: - assert not groupers + if not groupers: + raise ValueError( + "Providing a combination of `group` and **groupers is not supported." + ) grouper = UniqueGrouper() else: if len(groupers) > 1: raise ValueError("grouping by multiple variables is not supported yet.") if not groupers: - raise ValueError + raise ValueError("**groupers must be provided if `group` is not.") group, grouper = next(iter(groupers.items())) rgrouper = ResolvedGrouper(grouper, group, self)