用法:
Series.factorize(na_sentinel=- 1)
將輸入值編碼為整數標簽。
- na_sentinel:數字
表示缺失類別的值。
- (labels, cats):(cupy.ndarray、cupy.ndarray 或索引)
labels
包含編碼值cats
包含類別,以便 N-th 項目對應於 (N-1) 代碼。
參數:
返回:
例子:
>>> import cudf >>> s = cudf.Series(['a', 'a', 'c']) >>> codes, uniques = s.factorize() >>> codes array([0, 0, 1], dtype=int8) >>> uniques StringIndex(['a' 'c'], dtype='object')
相關用法
- Python cudf.Series.from_pandas用法及代碼示例
- Python cudf.Series.floordiv用法及代碼示例
- Python cudf.Series.fillna用法及代碼示例
- Python cudf.Series.from_categorical用法及代碼示例
- Python cudf.Series.from_masked_array用法及代碼示例
- Python cudf.Series.first用法及代碼示例
- Python cudf.Series.floor用法及代碼示例
- Python cudf.Series.from_arrow用法及代碼示例
- Python cudf.Series.ceil用法及代碼示例
- Python cudf.Series.update用法及代碼示例
- Python cudf.Series.max用法及代碼示例
- Python cudf.Series.head用法及代碼示例
- Python cudf.Series.reindex用法及代碼示例
- Python cudf.Series.interleave_columns用法及代碼示例
- Python cudf.Series.min用法及代碼示例
- Python cudf.Series.nlargest用法及代碼示例
- Python cudf.Series.to_frame用法及代碼示例
- Python cudf.Series.mask用法及代碼示例
- Python cudf.Series.notnull用法及代碼示例
- Python cudf.Series.isnull用法及代碼示例
注:本文由純淨天空篩選整理自rapids.ai大神的英文原創作品 cudf.Series.factorize。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。