k=pd.DataFrame({
"a":"222222",
"b":"33333",
},index=[[0]])
m=pd.DataFrame({
"c":"222222",
"n":"6554413"
},index=[[0]])
pd.merge(k,m,left_on=("a","b"),right_on=("c","n"))
```
I want to merge two dataframes using multiple connection keys,
But left_on can't pass in the list
help me
commit: None
python: 2.7.14.final.0
python-bits: 64
OS: Linux
OS-release: 3.10.0-327.el7.x86_64
machine: x86_64
processor:
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8
LOCALE: None.None
pandas: 0.23.4
pytest: 3.3.2
pip: 9.0.1
setuptools: 40.2.0
Cython: 0.27.3
numpy: 1.12.1
scipy: 1.1.0
pyarrow: None
xarray: None
IPython: 5.4.1
sphinx: 1.6.6
patsy: None
dateutil: 2.6.1
pytz: 2017.3
blosc: None
bottleneck: None
tables: None
numexpr: None
feather: None
matplotlib: 2.2.2
openpyxl: 2.4.10
xlrd: 1.1.0
xlwt: 1.3.0
xlsxwriter: 1.0.2
lxml: 4.1.1
bs4: 4.6.0
html5lib: 1.0.1
sqlalchemy: 1.2.1
pymysql: 0.9.2
psycopg2: None
jinja2: 2.10
s3fs: None
fastparquet: None
pandas_gbq: None
pandas_datareader: None
This works ok for me on master. You just don't have any matches in your key columns.
Try this example:
k=pd.DataFrame({
"a":["222222", "123"],
"b":["33333", "abc"]
},index=[[0,1]]
)
m=pd.DataFrame({
"c":["222222", "123"],
"n":["6554413", "abc"]
},index=[[0,1]]
)
pd.merge(k,m,left_on=("a","b"),right_on=("c","n"))
returns:
a b c n
0 123 abc 123 abc
thank you
Most helpful comment
This works ok for me on master. You just don't have any matches in your key columns.
Try this example:
returns: