【发布时间】:2020-05-23 18:23:05
【问题描述】:
import pandas as pd
import numpy as np
'''This is first dataframe'''
df1=pd.DataFrame({'fruit': ['apple', 'banana', 'orange']*3,'weight':['high','medium','low']*3
,'price': np.random.randint(0, 15, 9)})
'''This is second dataframe'''
df2=pd.DataFrame({'product': ['apple', 'orange', 'pine'] * 2,
'kilo': ['high', 'low'] * 3,
'price': np.random.randint(0, 15, 6)})
我想执行合并 合并=pd.merge(left_on=['fruit','weight'],right_on=['product','kilo'],how='inner',suffixes= ['_左右']) 它给出了类型错误
【问题讨论】:
-
pd.merge在哪些数据帧上?将您的数据框作为输入。 -
我不想在特定的数据帧上执行它。