I am trying to write a list of lists into an excel sheet using pandas the list looks like:
List_of Lists = [ [1,2,3,4],
[5,6,7,8],
[9,10,11,12],
........,
]
The number of these lists inside the main list could go up to a 1000. I also want to label them like colums1, colomns2, until colums100 for instance. on the same sheets. can anyone familiar with pandas help me? as this could be really easy for some?
I believe you can just pass the list into
pd.DataFrame()
and you will just get NaNs for the values that don't exist.For example:
Then to get the naming the way you want just use
pandas.DataFrame.add_prefix
Now I guess there is the possibility that you also could want each list to be a column. In that case you need to transpose your
List_of_Lists
.