how to create dictionary from dataframe in python code example Example: pandas to dictionary df.to_dict('records')