I have the following JSON snippet:
{'search_metadata': {'completed_in': 0.027,
'count': 2},
'statuses': [{'contributors': None,
'coordinates': None,
'created_at': 'Wed Mar 31 19:25:16 +0000 2021',
'text': 'The text',
'truncated': True,
'user': {'contributors_enabled': False,
'screen_name': 'abcde',
'verified': false
}
}
,{...}]
}
The info that interests me is all in the statuses
array. With pandas I can turn this into a DataFrame like this
df = pd.DataFrame(Data['statuses'])
Then I extract a subset out of this dataframe with
dfsub = df[['created_at', 'text']]
display(dfsub)
shows exactly what I expect.
But I also want to include [user][screen_name]
to the subset.
dfs = df[[ 'user', 'created_at', 'text']]
is syntactically correct but user
contains to much information.
How do I add only the screen_name
to the subset?
I have tried things like the following but none of that works
[user][screen_name]
user.screen_name
user:screen_name