I have some csv files. they have one common column item_id
.
How can I merge the csvs to get columns item_id
, weight
, location
, price
?
With concat I have multiple same id and columns with NaN...
Here I try to create some csv and merge it to one
item_id = [1342,35513,5135,5351]
weight = [10,20,30,40]
location = ['A','B','B','A']
fcsv = {
'id': item_id,
'loc': location,
'weight': weight}
fcsv
fcsv_df = pd.DataFrame(fcsv)
fcsv_df
item_id =[35513,1342,5135,5351]
weight = [20,10,30,40]
price = [10555,25550,35550,4550]
fcsv2 = {'id': item_id,
'weight': weight,
'price': price,
}
fcsv2
fcsv2_df = pd.DataFrame(fcsv2)
fcsv_df.to_csv('csv1.csv')
fcsv2_df.to_csv('csv2.csv')
file = pd.concat([fcsv_df,fcsv2_df])
file
Here i try to get something like this...
1342,10,A,25550
35513,20,B,10555,
5135,30,B,35550,
5351,40,A,4550
Please tell me witch method i can use to do it. I try to find it second hour and 0...