I am trying to traverse JSON data brought into a Dataframe.
Here is the code used to bring the data in:
df = json_normalize(data['PatentBulkData'])
Each series of the Dataframe is a list. Each list contains a list of dictionaries as represented below.
For example, here is the list of dictionaries returned when I enter df['prosecutionHistoryDataBag.prosecutionHistoryData'][i]
:
[{'eventCode': 'PG-ISSUE',
'eventDate': '2020-04-23',
'eventDescriptionText': 'PG-Pub Issue Notification'},
{'eventCode': 'RQPR',
'eventDate': '2020-01-02',
'eventDescriptionText': 'Request for Foreign Priority (Priority Papers May Be Included)'},
{'eventCode': 'M844',
'eventDate': '2020-01-03',
'eventDescriptionText': 'Information Disclosure Statement (IDS) Filed'},
{'eventCode': 'M844',
'eventDate': '2020-01-02',
'eventDescriptionText': 'Information Disclosure Statement (IDS) Filed'},
{'eventCode': 'COMP',
'eventDate': '2020-02-04',
'eventDescriptionText': 'Application Is Now Complete'}]
Then, df['prosecutionHistoryDataBag.prosecutionHistoryData'][i][j]
would return the dictionary:
{'eventCode': 'PG-ISSUE',
'eventDate': '2020-04-23',
'eventDescriptionText': 'PG-Pub Issue Notification'}
I would like to iterate through each entry in the df['prosecutionHistoryDataBag.prosecutionHistoryData']
to identify rows containing a specific string in 'eventDescriptionText'
.
In the above example df['prosecutionHistoryDataBag.prosecutionHistoryData']
is a Series, df['prosecutionHistoryDataBag.prosecutionHistoryData'][i]
is a list, and ['prosecutionHistoryDataBag.prosecutionHistoryData'][i][j]
is a dictionary.
I would like to initially iterate through the list - and for each list iterate through the dictionary to see if 'eventDescriptionText' contains a specific string.
Thanks!