sksurv.preprocessing.
OneHotEncoder
Encode categorical columns with M categories into M-1 columns according to the one-hot scheme.
The order of non-categorical columns is preserved, encoded columns are inserted inplace of the original column.
allow_drop (boolean, optional, default: True) – Whether to allow dropping categorical columns that only consist of a single category.
feature_names_
List of encoded columns.
pandas.Index
categories_
Categories of encoded columns.
dict
encoded_columns_
Name of columns after encoding. Includes names of non-categorical columns.
list
__init__
Initialize self. See help(type(self)) for accurate signature.
Methods
__init__([allow_drop])
Initialize self.
fit(X[, y])
fit
Retrieve categorical columns.
fit_transform(X[, y])
fit_transform
Convert categorical columns to numeric values.
transform(X)
transform
X (pandas.DataFrame) – Data to encode.
y – Ignored. For compatibility with Pipeline.
self – Returns self
object
y – Ignored. For compatibility with TransformerMixin.
fit_params – Ignored. For compatibility with TransformerMixin.
Xt – Encoded data.
pandas.DataFrame