pandas key value from two columns code example Example: dictionary from two columns pandas pd.Series(df.A.values,index=df.B).to_dict()