@@ -179,14 +179,15 @@ def test_groupby_reduce(
179
179
elif func == "count" :
180
180
expected_result = np .array (expected , dtype = np .intp )
181
181
182
- (result , groups ) = groupby_reduce (
182
+ (result , * groups ) = groupby_reduce (
183
183
array ,
184
184
by ,
185
185
func = func ,
186
186
expected_groups = expected_groups ,
187
187
fill_value = 123 ,
188
188
engine = engine ,
189
189
)
190
+ (groups_array ,) = groups
190
191
# we use pd.Index(expected_groups).to_numpy() which is always int64
191
192
# for the values in this test
192
193
if expected_groups is None :
@@ -196,7 +197,7 @@ def test_groupby_reduce(
196
197
else :
197
198
g_dtype = np .int64
198
199
199
- assert_equal (groups , np .array ([0 , 1 , 2 ], g_dtype ))
200
+ assert_equal (groups_array , np .array ([0 , 1 , 2 ], g_dtype ))
200
201
assert_equal (expected_result , result )
201
202
202
203
@@ -795,11 +796,14 @@ def test_groupby_bins(chunk_labels, kwargs, chunks, engine, method) -> None:
795
796
labels = dask .array .from_array (labels , chunks = chunks )
796
797
797
798
with raise_if_dask_computes ():
798
- actual , groups = groupby_reduce (
799
+ actual , * groups = groupby_reduce (
799
800
array , labels , func = "count" , fill_value = 0 , engine = engine , method = method , ** kwargs
800
801
)
802
+ (groups_array ,) = groups
801
803
expected = np .array ([3 , 1 , 0 ], dtype = np .intp )
802
- for left , right in zip (groups , pd .IntervalIndex .from_arrays ([1 , 2 , 4 ], [2 , 4 , 5 ]).to_numpy ()):
804
+ for left , right in zip (
805
+ groups_array , pd .IntervalIndex .from_arrays ([1 , 2 , 4 ], [2 , 4 , 5 ]).to_numpy ()
806
+ ):
803
807
assert left == right
804
808
assert_equal (actual , expected )
805
809
@@ -1034,13 +1038,13 @@ def test_bool_reductions(func, engine):
1034
1038
def test_map_reduce_blockwise_mixed () -> None :
1035
1039
t = pd .date_range ("2000-01-01" , "2000-12-31" , freq = "D" ).to_series ()
1036
1040
data = t .dt .dayofyear
1037
- actual , _ = groupby_reduce (
1041
+ actual , * _ = groupby_reduce (
1038
1042
dask .array .from_array (data .values , chunks = 365 ),
1039
1043
t .dt .month ,
1040
1044
func = "mean" ,
1041
1045
method = "map-reduce" ,
1042
1046
)
1043
- expected , _ = groupby_reduce (data , t .dt .month , func = "mean" )
1047
+ expected , * _ = groupby_reduce (data , t .dt .month , func = "mean" )
1044
1048
assert_equal (expected , actual )
1045
1049
1046
1050
0 commit comments