hipdf.core.accessors.string.StringMethods.split_part

hipdf.core.accessors.string.StringMethods.split_part#

1 min read time

Applies to Linux

StringMethods.split_part(delimiter: str | None = None, index: int = 0) → Series | Index#

Splits the string by delimiter and returns the token at the given index.

Parameters#

delimiterstr, default None

The string to split on. If not specified, split on whitespace.

indexint, default 0

The index of the token to retrieve.

Returns#

Series or Index

Examples#

>>> import cudf
>>> s = cudf.Series(["a_b_c", "d_e", "f"])
>>> s.str.split_part(delimiter="_", index=1)
0       b
1       e
2    None
dtype: object