用法:
CategoricalAccessor.as_ordered(inplace: bool = False) → Optional[SeriesOrIndex]
設置要排序的分類。
- inplace:布爾值,默認為 False
是否就地添加類別或返回此類別的副本以及添加的類別。
- 分類的
有序分類或無(如果就位)。
參數:
返回:
例子:
>>> import cudf >>> s = cudf.Series([10, 1, 1, 2, 10, 2, 10], dtype="category") >>> s 0 10 1 1 2 1 3 2 4 10 5 2 6 10 dtype: category Categories (3, int64): [1, 2, 10] >>> s.cat.as_ordered() 0 10 1 1 2 1 3 2 4 10 5 2 6 10 dtype: category Categories (3, int64): [1 < 2 < 10] >>> s.cat.as_ordered(inplace=True) >>> s 0 10 1 1 2 1 3 2 4 10 5 2 6 10 dtype: category Categories (3, int64): [1 < 2 < 10]
相關用法
- Python cudf.core.column.categorical.CategoricalAccessor.as_unordered用法及代碼示例
- Python cudf.core.column.categorical.CategoricalAccessor.add_categories用法及代碼示例
- Python cudf.core.column.categorical.CategoricalAccessor.reorder_categories用法及代碼示例
- Python cudf.core.column.categorical.CategoricalAccessor.remove_categories用法及代碼示例
- Python cudf.core.column.categorical.CategoricalAccessor.set_categories用法及代碼示例
- Python cudf.core.column.string.StringMethods.is_vowel用法及代碼示例
- Python cudf.core.column.string.StringMethods.endswith用法及代碼示例
- Python cudf.core.column.string.StringMethods.title用法及代碼示例
- Python cudf.core.column.string.StringMethods.contains用法及代碼示例
- Python cudf.core.column.string.StringMethods.rsplit用法及代碼示例
- Python cudf.core.column.string.StringMethods.zfill用法及代碼示例
- Python cudf.core.column.string.StringMethods.hex_to_int用法及代碼示例
- Python cudf.core.column.string.StringMethods.htoi用法及代碼示例
- Python cudf.core.column.string.StringMethods.character_tokenize用法及代碼示例
- Python cudf.core.column.string.StringMethods.normalize_characters用法及代碼示例
- Python cudf.core.column.string.StringMethods.filter_alphanum用法及代碼示例
- Python cudf.core.column.string.StringMethods.split用法及代碼示例
- Python cudf.core.column.string.StringMethods.ngrams用法及代碼示例
- Python cudf.core.column.struct.StructMethods.explode用法及代碼示例
- Python cudf.core.column.lists.ListMethods.concat用法及代碼示例
注:本文由純淨天空篩選整理自rapids.ai大神的英文原創作品 cudf.core.column.categorical.CategoricalAccessor.as_ordered。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。