Skip to content

Commit b6a7edc

Browse files
committed
Avoid copies
1 parent a5cf26e commit b6a7edc

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

flox/core.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -522,7 +522,7 @@ def factorize_(
522522
# this is important in shared-memory parallelism with dask
523523
# TODO: figure out how to avoid this
524524
idx = flat.copy()
525-
found_groups.append(np.array(expect, like=flat))
525+
found_groups.append(np.array(expect, like=flat, copy=False))
526526
# TODO: fix by using masked integers
527527
idx[idx > expect[-1]] = -1
528528

@@ -538,7 +538,9 @@ def factorize_(
538538
idx = np.digitize(
539539
flat,
540540
bins=np.array(
541-
bins.view(np.intp) if bins.dtype.kind == "M" else bins, like=flat
541+
bins.view(np.intp) if bins.dtype.kind == "M" else bins,
542+
like=flat,
543+
copy=False,
542544
),
543545
right=right,
544546
)

0 commit comments

Comments
 (0)