As simple as it seems, I could not find any solution for my question online. Basically, I have two arrays a and b that I want to save to a csv file. It will be two columns. I want to add the column names as well. Below code I use to dump arrays to a csv.
from np import array, savetxt
a = array([1,2,3,4])
b = array([5,6,7,8])
savetxt('submission2.csv', zip(a,b), delimiter=',', fmt='%f')
How would I add column names? I would like the csv file to look like
Name1 Name2
1 5
2 6
3 7
4 8
It is so strange that this option is not in the savetxt function. header option does do it because it just pastes a comment into the first cell. Thanks.
Edit: Arrays