Support all pandas nullable integer types. (#8480)

- Enumerate all pandas integer types.
- Tests for `None`, `nan`, and `pd.NA`
This commit is contained in:
Jiaming Yuan
2022-11-28 22:38:16 +08:00
committed by GitHub
parent f2209c1fe4
commit d666ba775e
7 changed files with 145 additions and 113 deletions

View File

@@ -10,6 +10,7 @@ from xgboost.testing import (
make_batches_sparse,
make_categorical,
make_sparse_regression,
predictor_equal,
)
from xgboost.testing.data import np_dtypes
@@ -246,11 +247,7 @@ class TestQuantileDMatrix:
for orig, x in np_dtypes(n_samples, n_features):
m0 = xgb.QuantileDMatrix(orig)
m1 = xgb.QuantileDMatrix(x)
csr0 = m0.get_data()
csr1 = m1.get_data()
np.testing.assert_allclose(csr0.data, csr1.data)
np.testing.assert_allclose(csr0.indptr, csr1.indptr)
np.testing.assert_allclose(csr0.indices, csr1.indices)
assert predictor_equal(m0, m1)
# unsupported types
for dtype in [