create and return dictionary in pandas code example Example: pandas to dictionary df.to_dict('records')