Skip to content

Commit 5aff565

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 6b82c85 commit 5aff565

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

pandas/core/reshape/merge.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3070,8 +3070,7 @@ def renamer(x, suffix: str | None):
30703070
dups.update(rlabels.intersection(left.difference(to_rename)))
30713071
if dups:
30723072
raise MergeError(
3073-
f"Passing 'suffixes' which cause duplicate columns {dups} is "
3074-
f"not allowed.",
3073+
f"Passing 'suffixes' which cause duplicate columns {dups} is not allowed.",
30753074
)
30763075

30773076
return llabels, rlabels

pandas/tests/reshape/merge/test_merge.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3066,13 +3066,12 @@ def test_merge_for_suffix_collisions():
30663066
# GH#61402
30673067
# Case 1: suffixes=("_dup", "") test collision
30683068
df1 = DataFrame({"col1": [1], "col2": [2]})
3069-
df2 = DataFrame({"col1": [1], "col2": [2], "col2_dup": [3]})
3070-
with pytest.raises(MergeError, match="duplicate columns"):
3069+
df2 = DataFrame({"col1": [1], "col2": [2], "col2_dup": [3]})
3070+
with pytest.raises(MergeError, match="duplicate columns"):
30713071
merge(df1, df2, on="col1", suffixes=("_dup", ""))
30723072

30733073
# Case 2: suffixes=("", "_dup") test collision
30743074
df1 = DataFrame({"col1": [1], "col2": [2]})
30753075
df2 = DataFrame({"col1": [1], "col2": [2], "col2_dup": [3]})
30763076
with pytest.raises(MergeError, match="duplicate columns"):
30773077
merge(df1, df2, on="col1", suffixes=("", "_dup"))
3078-

0 commit comments

Comments
 (0)