I am using Python 3.6.8 and I have been searching for a little white but I still cannot get the proper export to csv that I want.
I have a list of 1D array which I am trying to export into a CSV file. each array has a different size, and I want to export them following a column order, meaning each 1D array will be stored into 1 column in the CSV file.
To simplify my code, it will do something like this:
import pandas as pd
list_of_thing = []
a = np.arange(10)
list_of_thing.append(a)
b = np.arange(5)
list_of_thing.append(b)
csvfile = "./data.csv"
my_df = pd.DataFrame(list_of_thing)
my_df.to_csv(csvfile, index=False, header=False)
I also have tried to use np.savetext and using with open(csvfile, "w") as output: without much success.
What I am getting is this
0 1 2 3 4 5 6 7 8 9
0 1 2 3 4
When i wish it look like this
0 0
1 1
2 2
3 3
4 4
5
6
7
8
9
At the place of the append, I am thinking if it is possible to save everytime the array by specifying the column where it should go.