Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

pandas multiple string contains

# credit to Stack Overflow user in the source link

>>> df = pd.Series(['cat','hat','dog','fog','pet'])
>>> searchfor = ['og', 'at']
>>> df[df.str.contains('|'.join(searchfor))]

0    cat
1    hat
2    dog
3    fog
dtype: object
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #pandas #multiple #string
ADD COMMENT
Topic
Name
8+7 =