Skip to content

Commit 5bee907

Browse files
committed
BUG: (pandas-dev#34074) Added test and documentation
1 parent 99a8615 commit 5bee907

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

doc/source/whatsnew/v1.1.0.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -665,7 +665,7 @@ MultiIndex
665665
# Common elements are now guaranteed to be ordered by the left side
666666
left.intersection(right, sort=False)
667667
668-
-
668+
- Bug when joining 2 Multi-indexes, without specifying level with different columns. Return-indexers parameter is ignored. (:issue:`34074`)
669669

670670
I/O
671671
^^^

pandas/tests/indexes/multi/test_join.py

+11
Original file line numberDiff line numberDiff line change
@@ -103,3 +103,14 @@ def test_join_multi_wrong_order():
103103
tm.assert_index_equal(midx1, join_idx)
104104
assert lidx is None
105105
tm.assert_numpy_array_equal(ridx, exp_ridx)
106+
107+
def test_join_multi_return_indexers():
108+
# GH 34074
109+
110+
midx1 = pd.MultiIndex.from_product([[1, 2], [3, 4], [5, 6]], names=["a", "b", "c"])
111+
midx2 = pd.MultiIndex.from_product([[1, 2], [3, 4]], names=["a", "b"])
112+
113+
assert len(midx1.join(midx2,return_indexers=True)) == 3
114+
assert len(midx1.join(midx2,return_indexers=False)) == 1
115+
116+

0 commit comments

Comments
 (0)