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


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

用法:

StringMethods.get(i: int = 0) → SeriesOrIndex

從指定位置的每個組件中提取元素。

參數

iint

要提取的元素的位置。

返回

str dtype 的係列/索引

例子

>>> import cudf
>>> s = cudf.Series(["hello world", "rapids", "cudf"])
>>> s
0    hello world
1         rapids
2           cudf
dtype: object
>>> s.str.get(10)
0    d
1
2
dtype: object
>>> s.str.get(1)
0    e
1    a
2    u
dtype: object

get 也接受負索引號。

>>> s.str.get(-1)
0    d
1    s
2    f
dtype: object

相關用法


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