0
我有熊貓2個dataframes:如何使用重複的值合併兩個數據幀中的大熊貓
dilevery_time dispatch_time source_lat source_long Address name
0 21:39:37.265 21:47:37.265 -73.955741 40.3422 Dmart John
0 21:39:37.265 21:47:37.265 -73.955741 40.3422 Dmart John
而另一種是:
chef_name dish_name dish_price dish_quantity ratings
0 xyz Chicken 120 1 4
1 abc Paneer 100 2 3
我想在大熊貓加入這兩個dataframes。我已經執行了連接,但不允許我執行,因爲第一個數據幀具有重複的值。
所以,我已經做到了這一點:
pd.concat([df1, df2], join='inner', axis=1)
但是這給了我下面的輸出:
dilevery_time dispatch_time source_long Address name chef_name
0 21:39:37.265 21:47:37.265 -73.955741 Dmart John xyz
0 21:39:37.265 21:47:37.265 -73.955741 Dmart John xyz
dish_name dish_price dish_quantity ratings
0 Chicken 120 1 4
0 Chicken 120 1 4
而且我想在此格式:
dilevery_time dispatch_time source_long Address name chef_name
0 21:39:37.265 21:47:37.265 -73.955741 Dmart John xyz
0 21:39:37.265 21:47:37.265 -73.955741 Dmart John abc
dish_name dish_price dish_quantity ratings
0 Chicken 120 1 4
0 Paneer 100 2 3
怎麼辦它在熊貓?