cudf.core.column.string.StringMethods.slice_from#
- StringMethods.slice_from(starts: cudf.Series, stops: cudf.Series) SeriesOrIndex[source]#
使用每个字符串的位置返回每个字符串的子字符串。
starts 和 stops 参数是 Column 类型。
- Parameters:
- startsSeries
每个要提取的字符串的起始位置。 默认是每个字符串的开头。
- stopsSeries
每个字符串的结束位置。 默认是每个字符串的末尾。 使用-1指定到该字符串的末尾。
- Returns:
- Series/Index of str dtype
使用每个字符串的位置来获取每个字符串的子字符串。
示例
>>> import cudf >>> s = cudf.Series(["hello","there"]) >>> s 0 hello 1 there dtype: object >>> starts = cudf.Series([1, 3]) >>> stops = cudf.Series([5, 5]) >>> s.str.slice_from(starts, stops) 0 ello 1 re dtype: object