pandas dataframe to dict one column as key code example
Example 1: dataframe to dictionary with one column as key
pd.Series(df.A.values,index=df.B).to_dict()
Example 2: convert dict to dataframe
#Lazy way to convert json dict to df
pd.DataFrame.from_dict(data, orient='index').T
Example 3: pandas to dictionary
df.to_dict('records')