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


Python cudf.Series.explode用法及代碼示例

用法:

Series.explode(ignore_index=False)

將 list-like 的每個元素轉換為一行,複製索引值。

參數

ignore_index布爾值,默認為 False

如果為 True,則生成的索引將標記為 0、1、...、n - 1。

返回

DataFrame

例子

>>> import cudf
>>> s = cudf.Series([[1, 2, 3], [], None, [4, 5]])
>>> s
0    [1, 2, 3]
1           []
2         None
3       [4, 5]
dtype: list
>>> s.explode()
0       1
0       2
0       3
1    <NA>
2    <NA>
3       4
3       5
dtype: int64

相關用法


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