I have a structure like this:
[
[
('2019-12-01', '0.03555', '0.03', '0.03', '0.03'),
('2019-12-02', '0.03', '0.03', '1', '0.03')
],
[
('2019-12-01', '0.111', '0.02', '0.03', '0.03'),
('2019-12-02', '0.03', '0.03', '0.03', '0.03')
]
]
I would like each list entry to be an index in a pandas dataframe, with the tuples being rows in the df. Something like this:
LIST_1 LIST_2
date p1 p2 p3 p4 | p1 p2 p3 p4
0 2019-12-01 0.03555 0.03 0.03 0.03 | 0.03 0.03 0.03 0.03
1 2019-12-02 0.03 0.03 1 0.03 | 0.03 0.03 0.03 0.03
I know this is messy, to be honest, I'm unsure the best way to structure it in Pandas as I'm new to it, so any advice would be appreciated.
I have tried to flatten the strucutre using:
d = pd.DataFrame([t for lst in a for t in lst])
But then I just end up with a df as expect like this:
0 1 2 3 4
0 2019-12-01 0.03555 0.03 0.03 0.03
1 2019-12-02 0.03 0.03 1 0.03
2 2019-12-01 0.111 0.02 0.03 0.03
3 2019-12-02 0.03 0.03 0.03 0.03
But this isn't suitable