cudf.core.column.string.StringMethods.rfind#

StringMethods.rfind(sub: str, start: int = 0, end: int | None = None) SeriesOrIndex#

Return highest 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.rfind().

Parameters:
substr

Substring being searched.

startint

Left edge index.

endint

Right edge index.

Returns:
Series or Index of int

See also

find

Return lowest indexes in each strings.

Examples

>>> import cudf
>>> s = cudf.Series(["abc", "hello world", "rapids ai"])
>>> s.str.rfind('a')
0    0
1   -1
2    7
dtype: int32

Using start and end parameters.

>>> s.str.rfind('a', start=2, end=5)
0   -1
1   -1
2   -1
dtype: int32