Skip to content
Advertisement

How to convert nested dictionary to levelled Pandas Dataframe

How to convert more than 3 level N nested dictionary to levelled dataframe?

JavaScript

what I expect:

JavaScript
index level_0 level_1 value
0 .Stock .No_0 3241512
1 .Stock .No_1 1111111111
2 .Stock .No_2 444444444444
3 .Stock .Version 46
4 .Stock .Revision 78
5 .Time NaN 12.11.2022

Firsly I need to convert nested dictionary to list of levelled dictionaries, than lastly convert list of dictionaries to dataframe. How can I convert, pls help me!

I’ve already tried the code below but it doesn’t show exactly the right result.

JavaScript

Advertisement

Answer

I found solution, thanks for your comments:(

JavaScript
index level_0 level_1 value
0 .Stock .No_0 3241512
1 .Stock .No_1 1111111111
2 .Stock .No_2 444444444444
3 .Stock .Version 46
4 .Stock .Revision 78
5 .Time NaN 12.11.2022

This solves 6′ nested level of dictionary.

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement