Skip to content

Commit ee0cf28

Browse files
committed
fix
1 parent c3d10a3 commit ee0cf28

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

flox/core.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -653,6 +653,7 @@ def rechunk_for_blockwise(array: DaskArray, axis: T_Axis, labels: np.ndarray) ->
653653
DaskArray
654654
Rechunked array
655655
"""
656+
# TODO: this should be unnecessary?
656657
labels = factorize_((labels,), axes=())[0]
657658
chunks = array.chunks[axis]
658659
newchunks = _get_optimal_chunks_for_groups(chunks, labels)
@@ -2640,7 +2641,8 @@ def groupby_reduce(
26402641

26412642
partial_agg = partial(dask_groupby_agg, **kwargs)
26422643

2643-
if method == "blockwise" and by_.ndim == 1:
2644+
# if preferred method is already blockwise, no need to rechunk
2645+
if preferred_method != "blockwise" and method == "blockwise" and by_.ndim == 1:
26442646
array = rechunk_for_blockwise(array, axis=-1, labels=by_)
26452647

26462648
result, groups = partial_agg(

0 commit comments

Comments
 (0)