datafile (df) in .txt format is mentioned below where few of the fields are missing for some records . The missing fields should be kept as blank in the respective columns .
For example - data file in txt format is
1,name=Messi,car=ford,Price=234,Bike=Harley
2,name=Cavani,car=mazda,price=58,Bike=Ducatti
3,name=Dembele,car=toyota,Bike=Yamaha
4,name=kevin,car=Ford,price=989
5,name=Aguero,Bike=Ducatti
6,name=nadal,car=Ferrari,Bike=Harley
I want the file to be loaded to Python in the format below : required output with respective column names:
I want the column names as Number, CARNAME , PRICE , BIKENAME . I want the respective data to be populated in a DataFrame under the respective column names . The empty values should be kept as blank under the respective columns fields .
I am unable to post the image of the output or type the output here due to format issue . As I am new to stackoverflow , I don't have enough reputation to post the image
Please note that my dataset has million records.
name=
,car=
characters in the output DataFrame? – Bill Huang Oct 24 '20 at 19:225,name=Aguero...
on the same line as4
or is it a typo? – Andrej Kesely Oct 24 '20 at 19:25