I stored two dataframes into json as such
df_json= {
'df1': df1.to_json(orient='split'),
'df2': df2.to_json(orient='split')
}
df_dump = json.dumps(df_json)
Now I want to read my df_dump that has the two dataframes and store each one in an individual dataframe
df_1_extract = 'df1'
df_2_extract = 'df2'
CodePudding user response:
IIUC, try:
df_dict = json.loads(df_dump)
df_1_extract = pd.read_json(df_dict["df1"], orient="split")
df_2_extract = pd.read_json(df_dict["df2"], orient="split")