我有两个数据框:dfside amount price fee datetime symbol account_id order_id trade_id exchange4511 buy 4397.426832 6.84 4.397427 2020-08-18 13:08:15 xrpmxn prod_xrpmxn_bitso TX0s5HpiHH0C83xZ 17731587 bitso4512 buy 1.397976 6.84 0.001398 2020-08-18 13:05:02 xrpmxn prod_xrpmxn_bitso TX0s5HpiHH0C83xZ 17731587 bitso4513 buy 601.175192 6.84 0.601175 2020-08-18 13:04:00 xrpmxn prod_xrpmxn_bitso TX0s5HpiHH0C83xZ 17731587 bitso4514 buy 10000.000000 6.86 10.000000 2020-08-18 11:34:35 xrpmxn prod_xrpmxn_bitso TX0s5HpiHH0C83xZ 17731587 bitso4515 buy 300.000000 6.87 0.300000 2020-08-18 09:31:00 xrpmxn prod_xrpmxn_bitso TX0s5HpiHH0C83xZ 17731587 bitsodf_prodts exchange symbol trade_id order_id side price amount account_id fee4308 2020-09-16 16:20:50.307 bitso xrpmxn 18011784 Gtr8LC61Vdv9e1tP buy 5.1639 49.000000 prod_xrpmxn_bitso 49.0000004309 2020-09-16 16:21:54.502 bitso xrpmxn 18011803 Gtr8LC61Vdv9e1tP buy 5.1639 52.828604 prod_xrpmxn_bitso 0.0528294310 2020-09-16 16:23:05.198 bitso xrpmxn 18011853 Gtr8LC61Vdv9e1tP buy 5.1639 29898.171396 prod_xrpmxn_bitso 29.8981714311 2020-09-16 16:25:46.094 bitso xrpmxn 18011893 cHjL6T0emme2yO8K buy 5.1559 14347.930935 prod_xrpmxn_bitso 14.3479314312 2020-09-16 16:27:22.724 bitso xrpmxn 18011914 jbrHspMDN6mSSoTl buy 5.1544 138.738364 prod_xrpmxn_bitso 0.138738我试图比较 df_prod 中的每一行是否存在于 df 中,我尝试了以下操作:import numpy as npdf = pd.merge(df, df_prod, on=['amount','price'], how='left', indicator='Exist')df['Exist'] = np.where(df.Exist == 'both', True, False)print (df)但后来我有标题错误,我不明白,知道为什么吗?谢谢!
添加回答
举报
0/150
提交
取消