dataframe to dictionary by multiple columns as keys and rows as values 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()