Skip to content

Commit 8904332

Browse files
add more tests and modify comments
1 parent 1001ecf commit 8904332

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

pandas/core/reshape/merge.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,9 @@ def merge_ordered(left, right, on=None,
161161
Interpolation method for data
162162
suffixes : 2-length sequence (tuple, list, ...)
163163
Suffix to apply to overlapping column names in the left and right
164-
side, respectively. Except for tuple of (str, str), it also allows
165-
tuple of (None, str) or (str, None)
164+
side, respectively. And each element should be either a str or None,
165+
and at least one of elements must not be str. Valid inputs are like:
166+
(str, str), [str, str], (None, str), [str, None], [None, str] etc
166167
how : {'left', 'right', 'outer', 'inner'}, default 'outer'
167168
* left: use only keys from left frame (SQL: left outer join)
168169
* right: use only keys from right frame (SQL: right outer join)

pandas/tests/reshape/merge/test_merge.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1518,7 +1518,9 @@ def test_merge_series(on, left_on, right_on, left_index, right_index, nm):
15181518
(0.0, 0.0, ("_x", None), ["0.0_x", 0.0]),
15191519
("b", "b", (None, "_y"), ["b", "b_y"]),
15201520
("a", "a", ("_x", None), ["a_x", "a"]),
1521-
("a", "b", ("_x", None), ["a", "b"])
1521+
("a", "b", ("_x", None), ["a", "b"]),
1522+
("a", "a", [None, "_x"], ["a", "a_x"]),
1523+
(0, 0, ["_a", None], ["0_a", 0])
15221524
])
15231525
def test_merge_suffix(col1, col2, suffixes, expected_cols):
15241526
# issue: 24782
@@ -1535,7 +1537,9 @@ def test_merge_suffix(col1, col2, suffixes, expected_cols):
15351537
@pytest.mark.parametrize("suffixes", [
15361538
(None, None),
15371539
('', None),
1538-
(None, '')
1540+
(None, ''),
1541+
[None, None],
1542+
['', None]
15391543
])
15401544
def test_merge_suffix_errors(suffixes):
15411545
# issue: 24782

0 commit comments

Comments
 (0)