How to do untangle nested dictionary with list in key/value into columns? I tried different combination to solve converting nested dictionary into pandas data frame. Looked through the stack I am getting close to fix the problem just not quite.
Sample Data:
test = {
'abc': {
'company_id': '123c',
'names': ['Oscar', 'John Smith', 'Smith, John'],
'education': ['MS', 'BS']
},
'DEF': {
'company_id': '124b',
'names': ['Matt B.'],
'education': ['']
}
}
Tried:
1)
pd.DataFrame(list(test.items())) # not working entirely - creates {dictionary in col '1'}
2)
df = pd.concat({
k: pd.DataFrame.from_dict(v, 'index') for k, v in test.items()
},
axis=0)
df2 = df.T
df2.reset_index() # creates multiple columns
Output Needed:
