8000 TST: test was relying on arch-dependent casting of NaN (#13265) · xhluca/scikit-learn@9d00316 · GitHub
[go: up one dir, main page]

Skip to content

Commit 9d00316

Browse files
jnothmanXing
authored and
Xing
committed
TST: test was relying on arch-dependent casting of NaN (scikit-learn#13265)
1 parent 11d5539 commit 9d00316

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

sklearn/datasets/tests/test_openml.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
_retry_with_clean_cache)
1818
from sklearn.utils.testing import (assert_warns_message,
1919
assert_raise_message)
20+
from sklearn.utils import is_scalar_nan
2021
from urllib.error import HTTPError
2122
from sklearn.datasets.tests.test_common import check_return_X_y
2223
from functools import partial
@@ -37,8 +38,8 @@ def decode_column(data_bunch, col_idx):
3738
# XXX: This would be faster with np.take, although it does not
3839
# handle missing values fast (also not with mode='wrap')
3940
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]]
4243
return np.array(result, dtype='O')
4344
else:
4445
# non-nominal attribute

0 commit comments

Comments
 (0)
0