Jan-08-2021, 12:54 AM
Sample data:
I tried the following:
Thanks
Output:business_name
john chin elementary school
sutter pub and restaurant
sri thai cuisine
washington bakery & restaurant
brothers restaurant
The goal is to filter out which of these contain the word 'restaurant'.I tried the following:
import pandas as pd a = sf_restaurant_health_violations['business_name'].to_frame() a['is_restaurant'] = a['business_name'].str.lower().isin(['restaurant']) print(a)..and I get the following output:
Output:business_name is_restaurant
john chin elementary school FALSE
sutter pub and restaurant FALSE
sri thai cuisine FALSE
washington bakery & restaurant FALSE
brothers restaurant FALSE
The desired output is:Output:john chin elementary school FALSE
sutter pub and restaurant TRUE
sri thai cuisine FALSE
washington bakery & restaurant TRUE
brothers restaurant TRUE
Would appreciate some assistance here.Thanks