Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

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)
Comment

PREVIOUS NEXT
Code Example
Python :: django create username and password from csv 
Python :: merge df datacamp 
Python :: Escala, Translação e Rotação em Vídeos - Python 
Python :: python indent selection 
Python :: python read text file to list 
Python :: colab not training always giving cuda out of memory error eventhough memory is available 
Python :: arrow.get(null) 
Python :: numpy count occurrences in interval array 
Python :: base conversion python 
Python :: how to print string in python 
Python :: spacy text annotation dict comprehension 
Python :: astype oandas 
Python :: write dict to json file with special characters 
Python :: difference between methods and attributes 
Python :: eeetimetable 
Python :: df.sample(frac=1) 
Python :: Random Hex Colors bar generator, python turtle 
Python :: add variable in text python 
Python :: df filter out rows that appear more than x times 
Python :: python print x y coordinates 
Python :: django models get all 
Python :: Dynamically limiting queryset of related field 
Python :: geomertry 
Python :: Parsing a url for IP address using python 
Python :: wget download file python magic 
Python :: Kinesis Client get_records response json 
Python :: compare if 2 numbers are relatively equal 
Python :: python sum 1-50 
Python :: cannot access modules from neighbouring directories jupyter notebook 
Python :: Fernet: Cannot decrypt strings saved in csv with pandas 
ADD CONTENT
Topic
Content
Source link
Name
1+7 =