cudf.core.column.string.StringMethods.removesuffix#

StringMethods.removesuffix(suffix: str) SeriesOrIndex[source]#

Remove a suffix from an object series.

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

Parameters:
suffixstr

Remove the suffix of the string.

Returns:
Series/Index: object

The Series or Index with given suffix removed.

Examples

>>> import cudf
>>> s = cudf.Series(["foo_str", "bar_str", "no_suffix"])
>>> s
0    foo_str
1    bar_str
2    no_suffix
dtype: object
>>> s.str.removesuffix("_str")
0    foo
1    bar
2    no_suffix
dtype: object