cudf.core.column.string.StringMethods.get#

StringMethods.get(i: int = 0) SeriesOrIndex#

Extract element from each component at specified position.

Parameters:
iint

Position of element to extract.

Returns:
Series/Index of str dtype

Examples

>>> import cudf
>>> s = cudf.Series(["hello world", "rapids", "cudf"])
>>> s
0    hello world
1         rapids
2           cudf
dtype: object
>>> s.str.get(10)
0    d
1
2
dtype: object
>>> s.str.get(1)
0    e
1    a
2    u
dtype: object

get also accepts negative index number.

>>> s.str.get(-1)
0    d
1    s
2    f
dtype: object