I have a function which create several dicts of dicts, based on some conditions.
However, I would really like to turn the dict into a dataframe after collecting it.
Similar but you can also use from_dict
:
df=pd.DataFrame.from_dict({(i, j, x) : y
for i in d.keys()
for j in d[i].keys()
for x, y in d[i][j].items()},
orient='index')
print (df)
lowPrice lowDate highPrice highDate change
TSLA 2011 negative 185.16 05/27/19 365.71 12/10/18 -0.49
2012 negative 185.16 05/27/19 365.71 12/10/18 -0.49
2013 negative 32.91 01/07/13 37.24 03/26/12 -0.12
positive 32.91 01/07/13 190.90 09/23/13 4.80