File tree 1 file changed +3
-2
lines changed 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change 17
17
_retry_with_clean_cache )
18
18
from sklearn .utils .testing import (assert_warns_message ,
19
19
assert_raise_message )
20
+ from sklearn .utils import is_scalar_nan
20
21
from urllib .error import HTTPError
21
22
from sklearn .datasets .tests .test_common import check_return_X_y
22
23
from functools import partial
@@ -37,8 +38,8 @@ def decode_column(data_bunch, col_idx):
37
38
# XXX: This would be faster with np.take, although it does not
38
39
# handle missing values fast (also not with mode='wrap')
39
40
cat = data_bunch .categories [col_name ]
40
- result = [cat [ idx ] if 0 <= idx < len ( cat ) else None for idx in
41
- data_bunch .data [:, col_idx ]. astype ( int ) ]
41
+ result = [None if is_scalar_nan ( idx ) else cat [ int ( idx )]
42
+ for idx in data_bunch .data [:, col_idx ]]
42
43
return np .array (result , dtype = 'O' )
43
44
else :
44
45
# non-nominal attribute
<
2DEA
rect height="11.9298746" rx="2" width="140.350877" x="17.8947368" y="23.8597491">
You can’t perform that action at this time.
0 commit comments