Hi folks!
I am quite new to programming / python - the journey is fun but can be frustrating at times...
I have a .csv file about 300 columns. The first column has the date. The following columns contain my Objects.
I want to create separate .csv files with two columns: 1. Date; 2. Object
I want to tell Python:
Always take column 1 and one object-column and generate a .csv file from those two columns.
Then take column 1 (date) again and move on to the next object-column and generate the next .csv file.
Name the files after their object column.
So far i've got this:
(If I don't solve the problem I will have to do this by hand with excel - which gives me the creeps)
I am quite new to programming / python - the journey is fun but can be frustrating at times...
I have a .csv file about 300 columns. The first column has the date. The following columns contain my Objects.
I want to create separate .csv files with two columns: 1. Date; 2. Object
I want to tell Python:
Always take column 1 and one object-column and generate a .csv file from those two columns.
Then take column 1 (date) again and move on to the next object-column and generate the next .csv file.
Name the files after their object column.
So far i've got this:
import csv object = 0 f = open("/home/myComputer/Data/data.csv") csv_f = csv.reader(f, delimiter=';', quotechar='|') writer = csv.writer(csv_f) for row in csv_f: writer("[0],[object]") object += 1 f.close()Thank you very much for your help on this!
(If I don't solve the problem I will have to do this by hand with excel - which gives me the creeps)