Is there any function that would be the equivalent of a combination of df.isin() and df[col].str.contains()?
df.isin()
df[col].str.contains()
For example, say I have the s
You can use str.contains alone with a regex pattern using OR (|):
str.contains
OR (|)
s[s.str.contains('og|at')]
Or you could add the series to a dataframe then use str.contains:
dataframe
df = pd.DataFrame(s) df[s.str.contains('og|at')]
Output:
0 cat 1 hat 2 dog 3 fog