I am new to python. As such, I would greatly appreciate some advice on issues relating to manipulting data in CSV files. (1) In my code below, how to I specify Data1 and Data2 to be inserted into column 9 and column 10 in my CSV file? (2) Also, for future reference, how do I specify row and column to extract data or to write into in a csv file?
file1 = open (fileA.csv, 'rb')
reader1 = csv.reader(file1)
outfile = open ('fileB.csv', 'wb')
writer = csv.writer(outfile)
next(reader1, None) # skip the headers
for col in reader1:
subset1 = [float(x) for x in col[3:6]]
Max1 = max (subset1)
Min1 = min (subset1)
Data1 = str(Max1 - Min1)
subset2 = [float(x) for x in col[6:9]]
Max2 = max (subset2)
Min2 = min (subset2)
Data2 = str(Max2 - Min2)
........????
writer.writerow(Data)
file1.close()
outfile.close()
Many thanks!