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]}

Here is what the above code is Doing:
1. groupby(‘Column1’) – this groups the dataframe by the values in Column1
2. [‘Column3’] – this selects only the values in Column3
3. apply(list) – this applies the function list to each group
4. to_dict() – this converts the result to a dictionary