39
39
T_Dtypes = Union [np .typing .DTypeLike , Sequence [np .typing .DTypeLike ], None ]
40
40
T_FillValues = Union [np .typing .ArrayLike , Sequence [np .typing .ArrayLike ], None ]
41
41
T_Engine = Literal ["flox" , "numpy" , "numba" ]
42
- T_MethodCohorts = Literal ["cohorts" , "split-reduce" ]
43
- T_Method = Literal ["map-reduce" , "blockwise" , T_MethodCohorts ]
42
+ T_Method = Literal ["map-reduce" , "blockwise" , "cohorts" ]
44
43
T_IsBins = Union [bool | Sequence [bool ]]
45
44
46
45
@@ -161,8 +160,6 @@ def find_group_cohorts(labels, chunks, merge: bool = True):
161
160
merge : bool, optional
162
161
Attempt to merge cohorts when one cohort's chunks are a subset
163
162
of another cohort's chunks.
164
- method : ["split-reduce", "cohorts"], optional
165
- Which method are we using?
166
163
167
164
Returns
168
165
-------
@@ -1243,7 +1240,7 @@ def dask_groupby_agg(
1243
1240
partial (
1244
1241
blockwise_method ,
1245
1242
axis = axis ,
1246
- expected_groups = None if method in [ "split-reduce" , " cohorts"] else expected_groups ,
1243
+ expected_groups = None if method == " cohorts" else expected_groups ,
1247
1244
engine = engine ,
1248
1245
sort = sort ,
1249
1246
),
@@ -1268,7 +1265,7 @@ def dask_groupby_agg(
1268
1265
(len (expected_groups ),) if expected_groups is not None else (np .nan ,),
1269
1266
)
1270
1267
1271
- if method in ["map-reduce" , "cohorts" , "split-reduce" ]:
1268
+ if method in ["map-reduce" , "cohorts" ]:
1272
1269
combine : Callable [..., IntermediateDict ]
1273
1270
if do_simple_combine :
1274
1271
combine = _simple_combine
@@ -1306,7 +1303,7 @@ def dask_groupby_agg(
1306
1303
expected_groups_ = expected_groups
1307
1304
groups = (expected_groups_ .to_numpy (),)
1308
1305
1309
- elif method in [ "cohorts" , "split-reduce" ] :
1306
+ elif method == "cohorts" :
1310
1307
chunks_cohorts = find_group_cohorts (
1311
1308
by_input , [array .chunks [ax ] for ax in axis ], merge = True
1312
1309
)
@@ -1604,6 +1601,9 @@ def groupby_reduce(
1604
1601
if method in ["split-reduce" , "cohorts" ] and by_is_dask :
1605
1602
raise ValueError (f"method={ method !r} can only be used when grouping by numpy arrays." )
1606
1603
1604
+ if method == "split-reduce" :
1605
+ method = "cohorts"
1606
+
1607
1607
reindex = _validate_reindex (reindex , func , method , expected_groups , by_is_dask )
1608
1608
1609
1609
if not is_duck_array (array ):
@@ -1634,7 +1634,7 @@ def groupby_reduce(
1634
1634
1635
1635
# TODO: could restrict this to dask-only
1636
1636
factorize_early = (nby > 1 ) or (
1637
- any (isbins ) and method in [ "split-reduce" , " cohorts"] and is_duck_dask_array (array )
1637
+ any (isbins ) and method == " cohorts" and is_duck_dask_array (array )
1638
1638
)
1639
1639
if factorize_early :
1640
1640
bys , final_groups , grp_shape = _factorize_multiple (
@@ -1653,7 +1653,7 @@ def groupby_reduce(
1653
1653
axis_ = np .core .numeric .normalize_axis_tuple (axis , array .ndim ) # type: ignore
1654
1654
nax = len (axis_ )
1655
1655
1656
- if method in ["blockwise" , "cohorts" , "split-reduce" ] and nax != by_ .ndim :
1656
+ if method in ["blockwise" , "cohorts" ] and nax != by_ .ndim :
1657
1657
raise NotImplementedError (
1658
1658
"Must reduce along all dimensions of `by` when method != 'map-reduce'."
1659
1659
f"Received method={ method !r} "
0 commit comments