cudf.core.column.string.StringMethods.find#

StringMethods.find(sub: str, start: int = 0, end: int | None = None) SeriesOrIndex[source]#

Return lowest indexes in each strings in the Series/Index where the substring is fully contained between [start:end]. Return -1 on failure.

Parameters:
substr

Substring being searched.

startint

Left edge index.

endint

Right edge index.

Returns:
Series or Index of int

Examples

>>> import cudf
>>> s = cudf.Series(['abc', 'a','b' ,'ddb'])
>>> s.str.find('b')
0    1
1   -1
2    0
3    2
dtype: int32

Parameters such as start and end can also be used.

>>> s.str.find('b', start=1, end=5)
0    1
1   -1
2   -1
3    2
dtype: int32