Skip to content

Commit d2563d6

Browse files
Use itertools.pairwise instead of zip in false case
1 parent 80007c1 commit d2563d6

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

pandas/core/arrays/categorical.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
from csv import QUOTE_NONNUMERIC
44
from functools import partial
5+
import itertools
56
import operator
67
from shutil import get_terminal_size
78
from typing import (
@@ -2429,7 +2430,7 @@ def _reverse_indexer(self) -> dict[Hashable, npt.NDArray[np.intp]]:
24292430
ensure_platform_int(self.codes), categories.size
24302431
)
24312432
counts = ensure_int64(counts).cumsum()
2432-
_result = (r[start:end] for start, end in zip(counts, counts[1:], strict=False))
2433+
_result = (r[start:end] for start, end in itertools.pairwise(counts))
24332434
return dict(zip(categories, _result, strict=True))
24342435

24352436
# ------------------------------------------------------------------

0 commit comments

Comments
 (0)