Skip to content

Joining on a column, not index, gives erroneous result #13799

@Dmitrii-I

Description

@Dmitrii-I

Code Sample, a copy-pastable example if possible

import pandas as pd
d1 = pd.DataFrame({'a': [1, 2], 'b': [11, 22]})
d2 = pd.DataFrame({'a': [1, 2], 'c': ['aa', 'bb']})
d1.join(d2, on=['a'], how='outer', lsuffix='.d1', rsuffix='.d2')

Actual output

     a  a.d1     b  a.d2    c
0  1.0   1.0  11.0   2.0   bb
1  2.0   2.0  22.0   NaN  NaN
1  0.0   NaN   NaN   1.0   aa

Expected Output

   a   b   c
0  1  11  aa
1  2  22  bb

output of pd.show_versions()

INSTALLED VERSIONS

commit: None
python: 3.4.3.final.0
python-bits: 64
OS: Linux
OS-release: 3.19.0-65-generic
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8

pandas: 0.18.1
nose: None
pip: 1.5.4
setuptools: 3.3
Cython: None
numpy: 1.10.1
scipy: 0.17.1
statsmodels: 0.6.1
xarray: None
IPython: 4.0.0
sphinx: None
patsy: 0.4.1
dateutil: 2.5.2
pytz: 2016.3
blosc: None
bottleneck: None
tables: 3.2.2
numexpr: 2.4.6
matplotlib: None
openpyxl: None
xlrd: None
xlwt: None
xlsxwriter: None
lxml: None
bs4: None
html5lib: 0.999
httplib2: 0.9.2
apiclient: None
sqlalchemy: None
pymysql: None
psycopg2: 2.6.1 (dt dec pq3 ext lo64)
jinja2: 2.8
boto: None
pandas_datareader: None

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugError ReportingIncorrect or improved errors from pandasReshapingConcat, Merge/Join, Stack/Unstack, Explode

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions