Skip to content

Commit ecf28e5

Browse files
authored
STY: Add strict parameter to zip() in pandas/core/reshape/concat (#63350)
1 parent 43ca059 commit ecf28e5

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

pandas/core/reshape/concat.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
from __future__ import annotations
66

77
from collections import abc
8+
from itertools import pairwise
89
import types
910
from typing import (
1011
TYPE_CHECKING,
@@ -417,13 +418,11 @@ def concat(
417418
if (
418419
intersect
419420
or any(not isinstance(index, DatetimeIndex) for index in non_concat_axis)
420-
or all(
421-
prev is curr for prev, curr in zip(non_concat_axis, non_concat_axis[1:])
422-
)
421+
or all(prev is curr for prev, curr in pairwise(non_concat_axis))
423422
or (
424423
all(
425424
prev[-1] <= curr[0] and prev.is_monotonic_increasing
426-
for prev, curr in zip(non_concat_axis, non_concat_axis[1:])
425+
for prev, curr in pairwise(non_concat_axis)
427426
if not prev.empty and not curr.empty
428427
)
429428
and non_concat_axis[-1].is_monotonic_increasing

pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,6 @@ exclude = [
453453
"pandas/core/groupby/grouper.py" = ["B905"]
454454
"pandas/core/groupby/ops.py" = ["B905"]
455455
"pandas/core/methods/to_dict.py" = ["B905"]
456-
"pandas/core/reshape/concat.py" = ["B905"]
457456
"pandas/core/reshape/encoding.py" = ["B905"]
458457
"pandas/core/reshape/melt.py" = ["B905"]
459458
"pandas/core/reshape/merge.py" = ["B905"]

0 commit comments

Comments
 (0)