Answers for "pandas .contains"

11

dataframe column contains string

df[df['A'].str.contains("hello")]
Posted by: Guest on September-28-2020
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

Python Answers by Framework

Browse Popular Code Answers by Language