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