pandas groupby dictionary code example
Example 1: dataframe groupby to dictionary
In [81]: df.groupby('Column1')['Column3'].apply(list).to_dict()
Out[81]: {0: [1], 1: [2, 3, 5], 2: [1, 2], 3: [4, 5], 4: [1], 5: [1, 2, 3]}
Example 2: dict from group pandas
dict(tuple(df.groupby('a')))