I have a nested list of dictionaries and lists as below:
my_list = [{'a1':'1','b1':[{'c11':'2','d11':'3','e11':'4','f11':'5'},{'c12':'6','d12':'7','e12':'8','f12':'9'}],
'g1':'10','h1':'11'},
{'a2':'12','b2':[{'c21':'13','d21':'14','e21':'15','f21':'16'},{'c22':'17','d22':'18','e22':'19','f22':'20'}],
'g2':'21','h2':'22'},
.....,
.....
]
and I want to flatten the same as a dataframe like:
df = a1 c11 d11 e11 f11 c12 d12 e12 f12 g1 h1
1 2 3 4 5 6 7 8 9 10 11
12 13 14 15 16 17 18 19 20 21 22
how to flatten the list to DataFrame?
I tried looking at the sample code here Nested List to Pandas DataFrame with headers,
I've tried with json_normlize without success