cudf.core.column.string.StringMethods.removeprefix#
- StringMethods.removeprefix(prefix: str) SeriesOrIndex[source]#
从对象系列中移除前缀。
如果前缀不存在,将返回原始字符串。
- Parameters:
- prefixstr
移除字符串的前缀。
- Returns:
- Series/Index: object
移除给定前缀的Series或Index。
示例
>>> 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