用法:
DataFrame.label_encoding(column, prefix, cats, prefix_sep='_', dtype=None, na_sentinel=- 1)
使用標簽編碼對列中的標簽進行編碼。
- column:str
數據的二進製編碼的源列。
- prefix:str
新的列名前綴。
- cats:整數序列
作為整數的類別序列。
- prefix_sep:str
前綴和類別之間的分隔符。
- dtype :
輸出的 dtype;見係列。label_encoding
- na_sentinel:數字
表示缺失類別的值。
- 一個新的 DataFrame,為編碼值附加了一個新列。
參數:
返回:
例子:
>>> import cudf >>> df = cudf.DataFrame({'a':[1, 2, 3], 'b':[10, 10, 20]}) >>> df a b 0 1 10 1 2 10 2 3 20 >>> df.label_encoding(column="b", prefix="b_col", cats=[10, 20]) a b b_col_labels 0 1 10 0 1 2 10 0 2 3 20 1
相關用法
- Python cudf.DataFrame.last用法及代碼示例
- Python cudf.DataFrame.log用法及代碼示例
- Python cudf.DataFrame.lt用法及代碼示例
- Python cudf.DataFrame.le用法及代碼示例
- Python cudf.DataFrame.mod用法及代碼示例
- Python cudf.DataFrame.isin用法及代碼示例
- Python cudf.DataFrame.rmul用法及代碼示例
- Python cudf.DataFrame.apply用法及代碼示例
- Python cudf.DataFrame.exp用法及代碼示例
- Python cudf.DataFrame.drop用法及代碼示例
- Python cudf.DataFrame.where用法及代碼示例
- Python cudf.DataFrame.median用法及代碼示例
- Python cudf.DataFrame.to_pandas用法及代碼示例
- Python cudf.DataFrame.take用法及代碼示例
- Python cudf.DataFrame.tail用法及代碼示例
- Python cudf.DataFrame.rfloordiv用法及代碼示例
- Python cudf.DataFrame.equals用法及代碼示例
- Python cudf.DataFrame.head用法及代碼示例
- Python cudf.DataFrame.count用法及代碼示例
- Python cudf.DataFrame.isna用法及代碼示例
注:本文由純淨天空篩選整理自rapids.ai大神的英文原創作品 cudf.DataFrame.label_encoding。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。