I am trying to get some content from pandas column. The pandas dataframe is df and have a column named entities. This column seem to contain dictionaries. One of them is 'hashtags', which contains another dictionary 'text'. There can be multiple 'text' elements in a single row. Want to get the values for text field. The example below can help to understand. It will be helpful if I can get guidance on getting the hashtags values.
df['entities']
output =>
0 {'hashtags': [], 'symbols': [], 'user_mentions': [], 'urls': [{'url': '', 'expanded_url': 'https://twitter.com/i/web/status/1460865425911205891', 'display_url': 'twitter.com/i/web/status/1…', 'indices': [117, 140]}]}
1 {'hashtags': [{'text': 'carbon', 'indices': [17, 24]}, {'text': 'nature', 'indices': [48, 55]}], 'symbols': [], 'user_mentions': [], 'urls': [{'url': '', 'expanded_url': 'https://rpujolviven.blogspot.com/2012/10/infinite-growth.html', 'display_url': 'rpujolviven.blogspot.com/2012/10/infini…', 'indices': [61, 84]}, {'url': '', 'expanded_url': 'https...
2 {'hashtags': [{'text': 'Lincoln', 'indices': [69, 77]}], 'symbols': [], 'user_mentions': [], 'urls': [{'url': '', 'expanded_url': 'https://thelincolnite.co.uk/2021/11/professor-duncan-french-the-juggernaut-of-climate-politics-rolls-on/', 'display_url': 'thelincolnite.co.uk/2021/11/profes…', 'indices': [78, 101]}]}
3 {'hashtags': [{'text': 'CBDC', 'indices': [107, 112]}], 'symbols': [], 'user_mentions': [], 'urls': [{'url': , 'expanded_url': 'https://twitter.com/i/web/status/1460865388699344900', 'display_url': 'twitter.com/i/web/status/1…', 'indices': [115, 138]}]}
The expected output:
0 []
1 ['carbon', 'nature']
2 ['Lincoln']
3 ['CBDC']