dataframe to dictionary with one column as key code example
Example 1: dictionary from two columns pandas
pd.Series(df.A.values,index=df.B).to_dict()
Example 2: dataframe to dictionary with one column as key
pd.Series(df.A.values,index=df.B).to_dict()
Example 3: convert pandas group to dict
res = dict(tuple(d.groupby('a')))