简体   繁体   中英

Dataframe is empty after merging two dataframes with Pandas

I have two Dataframes in which I am trying to merge using pandas . One table is 4 columns and the other one is 3. I am attempting an inner join on an int64 type column. 图片显示数据类型

On the link you can see both columns named UPC are int64 types.

Just to make sure the Dataframes weren't empty, I have added a picture of the first 20 rows for each table.

表样本

when I try to merge I put the following command.

result = merge(MPA_COMMODITY, MDM_LINK_VIEW, on='UPC')

When I try to check the return value, it returns the column names but it says that the Dataframe is empty.

说数据框为空

This is using Python 3.6.4 and Pandas version 0.22.0.

If there is any other information needed please let me know. More than glad to update post if have to.

I think you want

MPA_COMMODITY.merge(MDM_LINK_VIEW, on='UPC')

https://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.merge.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM