I have a dataframe with 2 columns Address and ID. I want to merge IDs with the same addresses in a dictionary
import pandas as pd, numpy as np df = pd.DataFrame
In response to the comment about multiple columns:
>>> df Address ID Name 0 12 A Aa Alpha 1 66 C Bb Bravo 2 10 B Cc Charlie 3 10 B Dd Delta 4 12 A Ee Edgar 5 12 A Ff Frank >>> {k: v.to_dict() for k,v in df.groupby("Address")}