cudf.core.column.string.StringMethods.index#
- StringMethods.index(sub: str, start: int = 0, end: int = None) SeriesOrIndex #
Return lowest indexes in each strings where the substring is fully contained between
[start:end]
. This is the same as str.find except instead of returning -1, it raises a ValueError when the substring is not found.- Parameters
- substr
Substring being searched.
- startint
Left edge index.
- endint
Right edge index.
- Returns
- Series or Index of object
Examples
>>> import cudf >>> s = cudf.Series(['abc', 'a','b' ,'ddb']) >>> s.str.index('b') Traceback (most recent call last): File "<stdin>", line 1, in <module> ValueError: substring not found
Parameters such as start and end can also be used.
>>> s = cudf.Series(['abc', 'abb','ab' ,'ddb']) >>> s.str.index('b', start=1, end=5) 0 1 1 1 2 1 3 2 dtype: int32