pandas.Series.str.find¶
Return lowest indexes in each strings in the Series/Index
where the substring is fully contained between [start:end].
Return -1 on failure. Equivalent to standard str.find()
.
- param sub
- str
Substring being searched
- param start
- int
Left edge index
- param end
- int
Right edge index
- return
found : Series/Index of integer values
Limitations¶
Series elements are expected to be Unicode strings. Elements cannot be NaNs.
Parameters start
, end
are supported only with default value 0
and None
respectively.
Examples¶
import pandas as pd
from numba import njit
@njit
def series_str_find():
series = pd.Series(['foo', 'bar', 'foobar']) # Series of 'foo', 'bar', 'foobar'
out_series = series.str.find('bar')
return out_series # Expect series of -1, 0, 3
print(series_str_find())
$ python ./series/str/series_str_find.py
0 -1
1 0
2 3
dtype: int64
See also
- Series.str.rfind
Return highest indexes in each strings.
Todo
Add support of parameters start
and end