Skip to content

Commit a87fcf3

Browse files
committed
Small improvements
1 parent 8bf6c2b commit a87fcf3

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

flox/core.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -737,15 +737,12 @@ def _npg_aggregate(
737737
)
738738

739739

740-
def _conc2(x_chunk, key1, key2=None, axis=None) -> np.ndarray:
740+
def _conc2(x_chunk, key1, key2=slice(None), axis=None) -> np.ndarray:
741741
"""copied from dask.array.reductions.mean_combine"""
742742
from dask.array.core import _concatenate2
743743
from dask.utils import deepmap
744744

745-
if key2 is not None:
746-
mapped = deepmap(lambda x: x[key1][key2], x_chunk)
747-
else:
748-
mapped = deepmap(lambda x: x[key1], x_chunk)
745+
mapped = deepmap(lambda x: x[key1][key2], x_chunk)
749746
return _concatenate2(mapped, axes=axis)
750747

751748
# This doesn't seem to improve things at all; and some tests fail...
@@ -925,7 +922,7 @@ def groupby_agg(
925922
assert all(ax >= 0 for ax in axis)
926923

927924
# these are negative axis indices useful for concatenating the intermediates
928-
neg_axis = range(-len(axis), 0)
925+
neg_axis = tuple(range(-len(axis), 0))
929926

930927
inds = tuple(range(array.ndim))
931928
name = f"groupby_{agg.name}"

0 commit comments

Comments
 (0)