I am writing code that turns a dataframe into a list of dictionaries. Using to_dict('list'), it returns a dictionary that uses the column headers as the key and the rows in the column as values in a list. Is there a way to specify how many lists I want? I want it to return lists of 3 elements each.
This isn't the same as splitting a list into chunks as its a list of values in a dictionary.
#Original:
{Col_1 : [0, 1, 2, 3, 4, 5]}
#New:
split = 3
{Col_1: [0, 1, 2], [3, 4, 5]}