I have a JSON like this:
people = {
'jon' : { 'age' : 20 } ,
'peter' : { 'age' : 30 }
}
And I have a datframe indexed by name:
city | age | |
---|---|---|
jon | foo | NaN |
peter | foo | NaN |
What is the best way to populate the age in my dataframe using the JSON ?
Many thanks in advance !
I have tried something like this,
for line in ['jon','peter']:
df.at[line,'age'] = people[line]['age']
Which was really a wild try. There must be something much more obvious