0

I have an output as a dictionary with nested dictionaries.

d= {'article_1:({'X':{'A':(1,5), 'B':(0,3)}, 'Y':{'A':(3,5), 'B':(2,3)}}), 
    'article_2':({'X':{'A':(4,5), 'B':(1,3)}, 'Z':{'A':(2,5), 'B':(3,3)}})}

How I can turn this to a pandas MultiIndex table that looks like this :

enter image description here

  • the dictionary keys are main columns,
  • nested dictionary keys are subcolumns,
  • A and B person id.e.g. for row A: information is collected from the corresponding values of the nested dictionaries (1,5), (3,5),-,(4,5), (2,5)

I have read some solutions like Pandas: MultiIndex from Nested Dictionary, the difference is that here the column values are in different keys. I appreciate your help.

KKK
  • 115
  • 2
  • 8

0 Answers0