I'm trying to convert a dataframe that has inside other dataframe like:
{
'id': 3241234,
'data': {
'name':'carol',
'lastname': 'netflik',
'office': {
'num': 3543,
'department': 'trigy'
}
}
}
I tried to use:
pd.DataFrame.from_dict(data)
But the result dataframe looks like:
id data
lastname 3241234 netflik
name 3241234 carol
office 3241234 {'num': 3543, 'department': 'trigy'}
Any idea?
Loading a JSON/dict:
.json_normalized
to expand thedict
.If the dataframe has column of
dicts
If the dataframe has a column of
lists
withdicts
dicts
need to be removed from thelists
with.explode