File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -675,10 +675,15 @@ def _legacy_transform(self, X):
675
675
676
676
def _transform_new (self , X ):
677
677
"""New implementation assuming categorical input"""
678
- # validation of X happens in _check_X called by _transform
679
- X_int , X_mask = self ._transform (X , handle_unknown = self .handle_unknown )
678
+ X_temp = check_array (X , dtype = None )
679
+ if not hasattr (X , 'dtype' ) and np .issubdtype (X_temp .dtype , np .str_ ):
680
+ X = check_array (X , dtype = np .object )
681
+ else :
682
+ X = X_temp
680
683
681
- n_samples , n_features = X_int .shape
684
+ n_samples , n_features = X .shape
685
+
686
+ X_int , X_mask = self ._transform (X , handle_unknown = self .handle_unknown )
682
687
683
688
if self .drop is not None :
684
689
to_drop = self .drop_idx_ .reshape (1 , - 1 )
You can’t perform that action at this time.
0 commit comments