Skip to content

Commit 0a5d46a

Browse files
committed
BUG: Join with list of dataframes that have MultiIndex now behaves as expected (pandas-dev#57676)
1 parent 89898a6 commit 0a5d46a

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

pandas/core/frame.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -10604,7 +10604,12 @@ def join(
1060410604
# "Iterable[Union[DataFrame, Series]]" due to the if statements
1060510605
frames = [cast("DataFrame | Series", self)] + list(other)
1060610606

10607-
can_concat = all(df.index.is_unique for df in frames)
10607+
can_concat = True
10608+
for df in frames:
10609+
if isinstance(df.index, MultiIndex):
10610+
can_concat = all(idx.is_unique for idx in df.index.levels)
10611+
elif isinstance(df.index, Index) and not df.index.has_duplicates:
10612+
can_concat = False
1060810613

1060910614
# join indexes only using concat
1061010615
if can_concat:

0 commit comments

Comments
 (0)