I have a pandas dataframe like the following:
categories review_count
0 [Burgers, Fast Food, Restaurants] 137
1 [Steakhouses, Restaurants] 176
2 [Food, Coffee & Tea, American (New), Restaurants] 390
... .... ...
... .... ...
... .... ...
From this dataFrame,I would like to extract only those rows wherein the list in the 'categories' column of that row contains the category 'Restaurants'. I have so far tried:
df[[df.categories.isin('Restaurants'),review_count]],
as I also have other columns in the dataFrame, I specified these two columns that I want to extract. But I get the error:
TypeError: unhashable type: 'list'
I don't have much idea what this error means as I am very new to pandas. Please let me know how I can achieve my goal of extracting only those rows from the dataFrame wherein the 'categories' column for that row has the string 'Restaurants' as part of the categories_list. Any help would be much appreciated.
Thanks in advance!