用法:
class cudf.CategoricalIndex(data=None, categories=None, ordered=None, dtype=None, copy=False, name=None)
代表另一列索引的可排序值的分類
- data:array-like(一維)
分類的值。如果給出了類別,則不在類別中的值將被替換為 None/NaN。
- categories:list-like,可選
類別的類別。項目必須是唯一的。如果這裏沒有給出類別(也沒有在 dtype 中),它們將從數據中推斷出來。
- ordered:布爾型,可選
此分類是否被視為有序分類。如果未在此處或在 dtype 中給出,則生成的分類將是無序的。
- dtype:CategoricalDtype 或“category”,可選
如果是 CategoricalDtype,則不能與類別一起使用或排序。
- copy:布爾值,默認為 False
製作輸入的副本。
- name:對象,可選
要存儲在索引中的名稱。
- 分類索引
參數:
返回:
例子:
>>> import cudf >>> import pandas as pd >>> cudf.CategoricalIndex( ... data=[1, 2, 3, 4], categories=[1, 2], ordered=False, name="a") CategoricalIndex([1, 2, <NA>, <NA>], categories=[1, 2], ordered=False, dtype='category', name='a')
>>> cudf.CategoricalIndex( ... data=[1, 2, 3, 4], dtype=pd.CategoricalDtype([1, 2, 3]), name="a") CategoricalIndex([1, 2, 3, <NA>], categories=[1, 2, 3], ordered=False, dtype='category', name='a')
相關用法
- Python cudf.core.column.string.StringMethods.is_vowel用法及代碼示例
- Python cudf.Series.ceil用法及代碼示例
- Python cudf.core.column.string.StringMethods.endswith用法及代碼示例
- Python cudf.Series.update用法及代碼示例
- Python cudf.DataFrame.mod用法及代碼示例
- Python cudf.DataFrame.isin用法及代碼示例
- Python cudf.core.column.string.StringMethods.title用法及代碼示例
- Python cudf.DataFrame.rmul用法及代碼示例
- Python cudf.Series.max用法及代碼示例
- Python cudf.DatetimeIndex.dayofweek用法及代碼示例
- Python cudf.DataFrame.apply用法及代碼示例
- Python cudf.core.column.string.StringMethods.contains用法及代碼示例
- Python cudf.core.column.string.StringMethods.rsplit用法及代碼示例
- Python cudf.DataFrame.exp用法及代碼示例
- Python cudf.Series.head用法及代碼示例
- Python cudf.DataFrame.drop用法及代碼示例
- Python cudf.core.column.string.StringMethods.zfill用法及代碼示例
- Python cudf.Series.reindex用法及代碼示例
- Python cudf.Series.interleave_columns用法及代碼示例
- Python cudf.core.series.DatetimeProperties.month用法及代碼示例
注:本文由純淨天空篩選整理自rapids.ai大神的英文原創作品 cudf.CategoricalIndex。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。