Skip to content

Commit 1c21660

Browse files
committed
Fix bug
1 parent 5df4a75 commit 1c21660

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

flox/core.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -554,7 +554,7 @@ def factorize_(
554554
else:
555555
if expect is not None and reindex:
556556
sorter = np.argsort(expect)
557-
groups = expect[(sorter,)] if sort else expect
557+
groups = np.array(expect[(sorter,)]) if sort else expect
558558
idx = np.searchsorted(expect, flat, sorter=sorter)
559559
mask = ~np.isin(flat, expect) | isnull(flat) | (idx == len(expect))
560560
if not sort:
@@ -566,6 +566,7 @@ def factorize_(
566566
else:
567567
if isinstance(flat, np.ndarray):
568568
idx, groups = pd.factorize(flat, sort=sort)
569+
groups = np.array(groups)
569570
else:
570571
assert sort
571572
groups, idx = np.unique(flat, return_inverse=True)

0 commit comments

Comments
 (0)