Skip to content

Commit

Permalink
Merge pull request #779 from Marchlak/master
Browse files Browse the repository at this point in the history
fix (#742)
  • Loading branch information
pplonski authored Sep 25, 2024
2 parents ecd68f6 + 0312ae3 commit e5fd66e
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions supervised/preprocessing/preprocessing_categorical.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import numpy as np
import pandas as pd

from supervised.preprocessing.label_binarizer import LabelBinarizer
from supervised.preprocessing.label_encoder import LabelEncoder
Expand Down Expand Up @@ -78,6 +79,8 @@ def transform(self, X):
if transformed_values.dtype != X.loc[:, column].dtype and \
(X.loc[:, column].dtype == bool or X.loc[:, column].dtype == int):
X = X.astype({column: transformed_values.dtype})
if isinstance(X[column].dtype, pd.CategoricalDtype):
X[column] = X[column].astype('object')
X.loc[:, column] = transformed_values

return X
Expand Down

0 comments on commit e5fd66e

Please sign in to comment.