convert pandas dataframe to a nested dict,df = pd.DataFrame.from_dict(data)