Skip to content

Commit 966d5c6

Browse files
committed
BUG: group_shift_indexer checks for null group keys
1 parent 2c55f28 commit 966d5c6

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

pandas/src/algos_groupby_helper.pxi

+5
Original file line numberDiff line numberDiff line change
@@ -1356,6 +1356,11 @@ def group_shift_indexer(int64_t[:] out, int64_t[:] labels,
13561356
## reverse iterator if shifting backwards
13571357
ii = offset + sign * i
13581358
lab = labels[ii]
1359+
1360+
# Skip null keys
1361+
if lab == -1:
1362+
continue
1363+
13591364
label_seen[lab] += 1
13601365

13611366
idxer_slot = label_seen[lab] % periods

0 commit comments

Comments
 (0)