I need to iterate over two datastructures, a DataFrame, and a list of empty lists. Since for my application they always share the same iterable length in common (i.e. there are k dataframe columns and therefore initially k empty lists), is it possible to have them in the same for loop like below? The idea being that the dataframe column value will be appended to one of the lists at the corresponding index location.
for i in dataframe, list_of_lists:
append dataframe.column[i] to list_of_lists[i]
Example:
list_of_lists: [[][][][][]]
dataframe columns: 1 2 3 4 5
Result:
[[1][2][3][4][5]]