當前位置: 首頁>>編程示例 >>用法及示例精選 >>正文


Python cudf.core.column.string.StringMethods.slice_from用法及代碼示例

用法:

StringMethods.slice_from(starts: cudf.Series, stops: cudf.Series) → SeriesOrIndex

使用每個字符串的位置返回每個字符串的子字符串。

開始和停止參數是列類型。

參數

startsSeries

要提取的每個字符串的開始位置。默認是每個字符串的開頭。

stopsSeries

要提取的每個字符串的結束位置。默認是每個字符串的結尾。使用 -1 指定到該字符串的末尾。

返回

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

相關用法


注:本文由純淨天空篩選整理自rapids.ai大神的英文原創作品 cudf.core.column.string.StringMethods.slice_from。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。