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


Python cudf.MultiIndex用法及代碼示例

用法:

class cudf.MultiIndex(levels=None, codes=None, sortorder=None, names=None, dtype=None, copy=False, name=None, **kwargs)

multi-level 或分層索引。

為 Series 和 DataFrame 對象提供 N 維索引。

參數

levels數組序列

每個級別的唯一標簽。

codes: sequence of arrays

每個級別的整數,指定每個位置的標簽。

sortorder可選整數

尚不支持

names: optional sequence of objects

每個索引級別的名稱。

copy布爾值,默認為 False

複製級別和代碼。

verify_integrity布爾值,默認為真

檢查級別/代碼是否一致且有效。尚不支持

返回

多索引

例子

>>> import cudf
>>> cudf.MultiIndex(
... levels=[[1, 2], ['blue', 'red']], codes=[[0, 0, 1, 1], [1, 0, 1, 0]])
MultiIndex([(1,  'red'),
            (1, 'blue'),
            (2,  'red'),
            (2, 'blue')],
           )

相關用法


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