Find Values in a Pandas Series
Understand how to use find and any in a Pandas series.
We'll cover the following...
Try it yourself
Try executing the code below to see the result.
Press + to interact
import pandas as pdheros = pd.Series(['Batman', 'Wonder Woman', 'Superman'])if heros.str.find('Iron Man').any():print('Wrong universe')else:print('DC')
Python’s str.find
documentation says the following:
“Return the lowest index in the string where substring
sub
is ...