Skip to content

Commit 288654d

Browse files
authored
Change join type only for concat() case
Prevents changing the join type from 'left' to 'outer' when merge() is used. Fixes pandas-dev#19607.
1 parent 7dcc864 commit 288654d

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

pandas/core/frame.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5328,18 +5328,18 @@ def _join_compat(self, other, on=None, how='left', lsuffix='', rsuffix='',
53285328
raise ValueError('Joining multiple DataFrames only supported'
53295329
' for joining on index')
53305330

5331-
# join indexes only using concat
5332-
if how == 'left':
5333-
how = 'outer'
5334-
join_axes = [self.index]
5335-
else:
5336-
join_axes = None
5337-
53385331
frames = [self] + list(other)
53395332

53405333
can_concat = all(df.index.is_unique for df in frames)
53415334

5335+
# join indexes only using concat
53425336
if can_concat:
5337+
if how == 'left':
5338+
how = 'outer'
5339+
join_axes = [self.index]
5340+
else:
5341+
join_axes = None
5342+
53435343
return concat(frames, axis=1, join=how, join_axes=join_axes,
53445344
verify_integrity=True)
53455345

0 commit comments

Comments
 (0)