1import pandas as pd
2
3list1 = [1,2,3,4,5]
4df = pd.DataFrame(list1)
5df.to_csv('filename.csv', index=False)
6
7#index =false removes unnecessary indexing/numbering in the csv
1# Convert a list into rows for a column in csv
2
3import csv
4for_example = [1, 2, 3, 4, 5, 6]
5with open('output.csv', 'w', newline='') as csv_1:
6 csv_out = csv.writer(csv_1)
7 csv_out.writerows([for_example[index]] for index in range(0, len(for_example)))
8