Skip to content

Commit 8398661

Browse files
committed
TST: Check for correct index after left-joining a sequence of dataframes (pandas-dev#19607)
1 parent 20a7efc commit 8398661

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

pandas/tests/frame/test_join.py

+11
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@ def right():
3131
return DataFrame({'b': [300, 100, 200]}, index=[3, 1, 2])
3232

3333

34+
@pytest.fixture
35+
def right_non_unique():
36+
return DataFrame({'c': [400, 500, 600]}, index=[2, 2, 4])
37+
38+
3439
@pytest.mark.parametrize(
3540
"how, sort, expected",
3641
[('inner', False, DataFrame({'a': [20, 10],
@@ -165,3 +170,9 @@ def test_join_period_index(frame_with_period_index):
165170
index=frame_with_period_index.index)
166171

167172
tm.assert_frame_equal(joined, expected)
173+
174+
175+
def test_join_left_sequence_non_unique_index(left, right, right_non_unique):
176+
# corner case: left joining a sequence of dataframes with non-unique indices (issue #19607)
177+
joined = left.join([right_non_unique], how='left')
178+
tm.assert_index_equal(joined.index.unique().sort_values(), left.index.sort_values())

0 commit comments

Comments
 (0)