Skip to content

Commit 96a04b8

Browse files
add more tests and modify comments
1 parent 2cbb1fd commit 96a04b8

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
@@ -1452,7 +1452,9 @@ def test_merge_series(on, left_on, right_on, left_index, right_index, nm):
14521452
(0.0, 0.0, ("_x", None), ["0.0_x", 0.0]),
14531453
("b", "b", (None, "_y"), ["b", "b_y"]),
14541454
("a", "a", ("_x", None), ["a_x", "a"]),
1455-
("a", "b", ("_x", None), ["a", "b"])
1455+
("a", "b", ("_x", None), ["a", "b"]),
1456+
("a", "a", [None, "_x"], ["a", "a_x"]),
1457+
(0, 0, ["_a", None], ["0_a", 0])
14561458
])
14571459
def test_merge_suffix(col1, col2, suffixes, expected_cols):
14581460
# issue: 24782
@@ -1469,7 +1471,9 @@ def test_merge_suffix(col1, col2, suffixes, expected_cols):
14691471
@pytest.mark.parametrize("suffixes", [
14701472
(None, None),
14711473
('', None),
1472-
(None, '')
1474+
(None, ''),
1475+
[None, None],
1476+
['', None]
14731477
])
14741478
def test_merge_suffix_errors(suffixes):
14751479
# issue: 24782

0 commit comments

Comments
 (0)