I have two .csv files, headers.csv
and corrected.csv
. Theheaders.csv
has all the headers, and the corrected.csv
is just a bunch of organized data.
headers.csv:
displacement, load, cputime, ...
corrected.csv:
-990.478170,-0.000026,15:08:06, ...
-990.038170,-0.000026,15:08:06, ...
The end goal is to be like this example:
displacement,load,cputime, ...
-990.478170,-0.000026,15:08:06, ...
-990.038170,-0.000026,15:08:06, ...
What I have:
headers = [x for x in csv.reader(open('headers.csv', 'rb'))]
writer = csv.writer(open('merged.csv', 'wb'))
writer.writerow(headers)
for row in csv.reader(open('corrected.csv', 'rb')):
writer.writerow(row)
The result, however, is that "['displacement', 'load', 'cputime', ...]"
is all written to column A while I want displacement in column A, load in column B, cputime in column C, etc. I also want to get rid of the ', ", [], and whitespace
so the end result is exactly like my example above. Thanks in advance!