Skip to content

Commit 5d451fe

Browse files
authored
PREF: Fix regression from #58984 (#59025)
* check uses_mask before * backup gh * backup gh
1 parent b7970fc commit 5d451fe

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

pandas/_libs/groupby.pyx

+5-4
Original file line numberDiff line numberDiff line change
@@ -398,11 +398,12 @@ def group_cumsum(
398398
for i in range(N):
399399
lab = labels[i]
400400

401-
if lab < 0:
401+
if uses_mask and lab < 0:
402402
# GH#58811
403-
if uses_mask:
404-
result_mask[i, :] = True
405-
out[i, :] = 0
403+
result_mask[i, :] = True
404+
out[i, :] = 0
405+
continue
406+
elif lab < 0:
406407
continue
407408

408409
for j in range(K):

0 commit comments

Comments
 (0)