File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change 22
33import numpy as np
44import pandas as pd
5- from pandas .api .types import is_categorical_dtype , is_float_dtype
5+ from pandas .api .types import is_float_dtype
66
77from pasteur .attribute import Attributes
88from pasteur .transform import RefTransformer , Transformer
@@ -147,7 +147,7 @@ def transform(self, data: pd.Series) -> pd.DataFrame:
147147 out_col = data .map (mapping )
148148
149149 # Handle categorical columns without blowing them up to full blown columns
150- if is_categorical_dtype (out_col ):
150+ if isinstance (out_col , pd . CategoricalDtype ):
151151 out_col = out_col .cat .add_categories (range (self .ofs ))
152152
153153 # Handle NAs correctly
@@ -166,7 +166,7 @@ def transform(self, data: pd.Series) -> pd.DataFrame:
166166 ), f"Uknown values found in '{ self .col } ', but no unknown value provided."
167167
168168 # Remove old categories to change dtype
169- if is_categorical_dtype (out_col ):
169+ if isinstance (out_col , pd . CategoricalDtype ):
170170 out_col = out_col .cat .set_categories (range (self .domain ))
171171
172172 return pd .DataFrame (out_col .astype (type ))
You can’t perform that action at this time.
0 commit comments