I have a DataFrame object, with multiple columns: business_id, categories, type_of_business...
I have managed to create a smaller DataFrame with only business_id and categories by column indexing on the original DataFrame object.
categories is a list of certain strings.Example: ['Restaurant, 'food', 'bakery'] - for each business_id.
One of the categories is Restaurants. How would I retrieve only those business ids where the word Restaurants is in the categories list.
Pseudocode:
for row in smaller_DataFrame:
if 'Restaurants' in row['categories']:
add this business_id to some dictionary.
I am interested in how I would incorporate the if condition in a DataFrame object.
Thanks in advance.