cudf.core.column.string.StringMethods.removeprefix#

StringMethods.removeprefix(prefix: str) SeriesOrIndex#

Remove a prefix from an object series.

If the prefix is not present, the original string will be returned.

Parameters
prefixstr

Remove the prefix of the string.

Returns
Series/Index: object

The Series or Index with given prefix removed.

Examples

>>> import cudf
>>> s = cudf.Series(["str_foo", "str_bar", "no_prefix"])
>>> s
0    str_foo
1    str_bar
2    no_prefix
dtype: object
>>> s.str.removeprefix("str_")
0    foo
1    bar
2    no_prefix
dtype: object