I have not used Pandas before and looks like I need some initial help. I could not really find this specific example anywhere.
I have a csv file, say file1.csv as following:
ID value1 value2
1 100 200
2 101 201
I need to read 1 line at a time from file1.csv, append 2 new column info/data, and then write everything to a new file called file2.csv. file2.csv is supposed to look like following:
ID value1 value2 value3 value4
1 100 200 10 20
2 101 201 11 21
Can anyone guide or give a short example showing how to do this (reading file1, appending the new data (value3 and value4 columns), and writing it to file2)?
ADDENDUM: I need to read 1 line at a time from file1 and write 1 line at a time to file2.
with open('file.csv') as f: ...will suffice