I have a function that produces a dataframe with 10 rows and i my goal is to get 135 of these dataframes. I don't want them separate, so I need to concatenate them into one dataframe so that it has 10 rows and 135 labeled columns, but i want to do this efficiently. The closest i got to what i needed was this:
for i in range(len(docs)):
for l in labels_list:
df = pd.concat([pd.DataFrame({l:(my_func(i)})])
But obviously this just returns the very last column of the dataframe...
EDIT
Another way:
I appended the result of my_func
into a list and i now have a list of lists with 135 lists and 10 strings in each list. I want to make a dataframe out of this with 135 columns and 10 rows, but the regular way gives me an error:
df2 = pd.DataFrame(list_of_df, columns=labels_list)
ValueError: 135 columns passed, passed data had 10 columns