Answers for "pandas terms for list of substring present in another list python"

0

pandas terms for list of substring present in another list python

import pandas as pd

companies = [['zmpEVqsbCUO1aXStxHkSVA', 'palms-car-wash'],
             ['5T0vKfIJWP1xTnxA7fJ17w', 'meat-and-bread'],
             ['C0d5kzUx6C19mLcxQyhxCA', 'alamo-drafthouse-cinema-'],
             ['ch1ercqwoNLpQLxpTb90KQ', 'boston-tea-stop']]

df = pd.DataFrame(data=companies, columns=['id', 'val'])

no_interest = ['museum', 'cinema', 'car']

out = df[~df['val'].str.contains('|'.join(no_interest))]
print(out)
Posted by: Guest on May-09-2021

Code answers related to "pandas terms for list of substring present in another list python"

Browse Popular Code Answers by Language