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