convert dataframe row to dictionary python code example Example: pandas to dictionary df.to_dict('records')