sksurv.column.encode_categorical#

sksurv.column.encode_categorical(table, columns=None, **kwargs)[source]#

Encode categorical columns with M categories into M-1 columns according to the one-hot scheme.

Parameters:
  • table (pandas.DataFrame) – Table with categorical columns to encode.

  • columns (list-like, optional, default: None) – Column names in the DataFrame to be encoded. If columns is None then all the columns with object or category dtype will be converted.

  • allow_drop (boolean, optional, default: True) – Whether to allow dropping categorical columns that only consist of a single category.

Returns:

encoded – Table with categorical columns encoded as numeric. Numeric columns in the input table remain unchanged.

Return type:

pandas.DataFrame