I have a for loop in python and at the end of each step I want the output to be added as a new column in a csv file. The output I have is a 40x1 array. So if the for loop consists of 100 steps, I want to have a csv file with 100 columns and 40 rows at the end. What I have now, at the end of each time step is the following:
with open( 'File name.csv','w') as output:
writer=csv.writer(output, lineterminator='\n')
for val in myvector:
writer.writerow([val])
However, this creates different csv files with 40 rows and 1 column each. How can have I add them all as different columns in the same csv file? This will save me a lot of computation time so any help would be very much appreciated.