Answers for "how to check if dataframe column contains any of substrigs from a list"

1

str.contains multiple strings

>>> searchfor = ['og', 'at']
>>> s[s.str.contains('|'.join(searchfor))]
0    cat
1    hat
2    dog
3    fog
dtype: object
Posted by: Guest on September-15-2020

Code answers related to "how to check if dataframe column contains any of substrigs from a list"

Browse Popular Code Answers by Language