You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When joining DataFrames where the calling frame is a multiindex DF and the input frame is a single-index DF, how='left' and how='right' produce results that should be swapped (i.e., 'left' returns what 'right' should return, and vice versa). To give a single example using how='left':
value1 value2
first second
a x 0.471780 10
y 0.774908 10
z 0.563634 10
b x -0.353756 20
y 0.368062 20
z -1.721840 20
c x 1.000000 NaN
y 2.000000 NaN
z 3.000000 NaN
Actual (for how='left'):
value1 value2
first second
a x 0.471780 10
y 0.774908 10
z 0.563634 10
b x -0.353756 20
y 0.368062 20
z -1.721840 20
However, the correct behavior occurs if the single-index DF is the calling frame and the multiindex DF is the input frame (df2.join(df1, how='left')). Behavior for how='inner' and how='outer' is correct in both situations.
pandas version 0.16.2
The text was updated successfully, but these errors were encountered:
When joining DataFrames where the calling frame is a multiindex DF and the input frame is a single-index DF,
how='left'
andhow='right'
produce results that should be swapped (i.e.,'left'
returns what'right'
should return, and vice versa). To give a single example usinghow='left'
:Expected (for
how='left'
):Actual (for
how='left'
):However, the correct behavior occurs if the single-index DF is the calling frame and the multiindex DF is the input frame (
df2.join(df1, how='left')
). Behavior forhow='inner'
andhow='outer'
is correct in both situations.pandas version 0.16.2
The text was updated successfully, but these errors were encountered: