list1 = [1,2,3]
list2 = [3,5,6]
list3 = [4,5,6]
I want output in csv file as:
A B C
1 3 4
2 5 5
3 6 6
I tried using pandas as well as np.savetxt() but it doesnt work!
Use DataFrame contructor with to_csv:
pd.DataFrame({'A': list1, 'B': list2, 'C':list3}).to_csv('file.csv', index=False)
If want custom order of columns:
(pd.DataFrame({'A': list1, 'B': list2, 'C':list3}, columns=['B','A','C'])
.to_csv('file.csv', index=False))