From 01355d59fc22860de0d7f04b86318944643ba0f6 Mon Sep 17 00:00:00 2001 From: Alexander Haupt <1485187+elrubio@users.noreply.github.com> Date: Fri, 9 Feb 2018 18:39:20 +0100 Subject: [PATCH] BUG: Fix 'left' join turned into 'outer' join when joining with a sequence of dataframes (#19607) --- pandas/core/frame.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/pandas/core/frame.py b/pandas/core/frame.py index 6d8dcb8a1ca89..a6417f821a4e6 100644 --- a/pandas/core/frame.py +++ b/pandas/core/frame.py @@ -5328,18 +5328,17 @@ def _join_compat(self, other, on=None, how='left', lsuffix='', rsuffix='', raise ValueError('Joining multiple DataFrames only supported' ' for joining on index') - # join indexes only using concat - if how == 'left': - how = 'outer' - join_axes = [self.index] - else: - join_axes = None - frames = [self] + list(other) can_concat = all(df.index.is_unique for df in frames) + # join indexes only using concat if can_concat: + if how == 'left': + how = 'outer' + join_axes = [self.index] + else: + join_axes = None return concat(frames, axis=1, join=how, join_axes=join_axes, verify_integrity=True)