-2

I have a nested dictionary

dic= {"JAN":{"A":"1" ,"B":"11", "C":"121"}, 
      "FEB":{"A":"2","B":"22", "C":"212"},
      "MAR":{"A":"3","B":"32", "C":"343"},
      "APR":{"A":"5","B":"32", "C":"90"}}

i want to convert the main dic keys i.e. ["JAN", "FEB", "MAR", "APR"] as columns of my dataframe,
and INDEX of that dataframe should be "A", "B" & "C" and the values should get assigned according to the group

EXPECTED OUTPUT: A Dataframe in a following manner

------------------------------------
     | "JAN" | "FEB" | "MAR" | "APR"
------------------------------------
  "A"|  "1"  | "2"   | "3"   | "5"
------------------------------------
  "B"|  "11" | "22"  | "32"  | "32"
------------------------------------
  "C"| "121" | "212" | "343" | "90"
------------------------------------
Amit
  • 691
  • 4
  • 12

0 Answers0