To filter Python Pandas DataFrame by substring criteria, we can call the str.contains
method.
For instance, we write
df[df['A'].str.contains("hello")]
to return a data frame with rows in column 'A'
that has strings containing 'hello'
with str.contains
.