henchman.learning.inplace_encoder

henchman.learning.inplace_encoder(X)[source]

Replace all columns with pd.dtype == ‘O’ with integers. This avoids the dimensionality problems of OHE at the cost of implying an artificial ordering in categorical features.

Parameters:X (pd.DataFrame) – The dataframe to encode.
Returns:A dataframe whose categorical columns have been replaced by integers.
Return type:pd.DataFrame

Example

>>> from henchman.learning import inplace_encoder
>>> X_enc = inplace_encoder(X)