I have a set of data with two lists. list_2 can have any number of nested lists in it (which is where my problem stems from).
list_1 = [2000.0, 2100.0, 2200.0]
list_2 = [[-1.86, 0.49, 1.36], [-1.29, 0.59, 1.62], [-.99, 0.19, 1.76]]
once in the csv file it should look like
2000 -1.86 -1.29 -.99
2100 0.49 0.59 0.19
2200 1.36 1.62 1.76
I have tried a few different ways of writing the file
with open(file_name, 'w') as file:
writer = csv.writer(file)
writer.writerows(zip(list_1, list_2))
I've also tried zipping them before as see in this question
I've also tried separating the lists (in list_2) but that does not allow for any growth. I do not know the number of nested lists before running the application so it has to be able to grow.
writer.writerows(zip(list_1, list_2, list_3, list_4)) # does not allow for dynamic growth