I have one dataframe and a json format variable.
json_obj = { 1: [ {"father": "john", "father_age": 50},
{"son": "johnson", "son_age": 20} ],
2: [ {"father": "smith", "father_age": 60},
{"son": "smithson", "son_age": 30} ] }
# df
index area
1 CA
2 NY
3 TX
I want to insert new column with inner dictionary's key and its value into df
# df_final
index area father father_age son son_age
1 CA john 50 joshnson 20
2 NY smith 60 smithson 30
3 TX
If its index and dictionary's key match, I want to insert data in that row. How can I make this?