dataframe two columns to dictionary code example
Example 1: dictionary from two columns pandas
pd.Series(df.A.values,index=df.B).to_dict()
Example 2: python how to create dict from dataframe based on 2 columns
In [9]: pd.Series(df.Letter.values,index=df.Position).to_dict()
Out[9]: {1: 'a', 2: 'b', 3: 'c', 4: 'd', 5: 'e'}