Skip to content

Commit dcfb1db

Browse files
committed
Better error message
1 parent f65cb52 commit dcfb1db

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

flox/core.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1480,7 +1480,10 @@ def groupby_reduce(
14801480
if len(by) == 1 and not isinstance(expected_groups, tuple):
14811481
expected_groups = (np.asarray(expected_groups),)
14821482
elif len(expected_groups) != len(by):
1483-
raise ValueError("len(expected_groups) != len(by)")
1483+
raise ValueError(
1484+
f"Must have same number of `expected_groups` (received {len(expected_groups)}) "
1485+
f" and variables to group by (received {len(by)})."
1486+
)
14841487

14851488
# We convert to pd.Index since that lets us know if we are binning or not
14861489
# (pd.IntervalIndex or not)

0 commit comments

Comments
 (0)