pd df to dictionary code example
Example 1: convert dict to dataframe
#Lazy way to convert json dict to df
pd.DataFrame.from_dict(data, orient='index').T
Example 2: pandas to dictionary
df.to_dict('records')
#Lazy way to convert json dict to df
pd.DataFrame.from_dict(data, orient='index').T
df.to_dict('records')