Avoid warning in np primitive type tests. (#7833)

This commit is contained in:
Jiaming Yuan 2022-04-23 02:07:01 +08:00 committed by GitHub
parent c45665a55a
commit 332380479b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 5 deletions

View File

@ -569,7 +569,7 @@ class TestModels:
y = rng.randn(rows) y = rng.randn(rows)
feature_names = ["test_feature_" + str(i) for i in range(cols)] feature_names = ["test_feature_" + str(i) for i in range(cols)]
X_pd = pd.DataFrame(X, columns=feature_names) X_pd = pd.DataFrame(X, columns=feature_names)
X_pd.iloc[:, 3] = X_pd.iloc[:, 3].astype(np.int) X_pd.iloc[:, 3] = X_pd.iloc[:, 3].astype(np.int32)
Xy = xgb.DMatrix(X_pd, y) Xy = xgb.DMatrix(X_pd, y)
assert Xy.feature_types[3] == "int" assert Xy.feature_types[3] == "int"

View File

@ -245,19 +245,23 @@ class TestInplacePredict:
predt_orig = self.booster.inplace_predict(orig) predt_orig = self.booster.inplace_predict(orig)
# all primitive types in numpy # all primitive types in numpy
for dtype in [ for dtype in [
np.signedinteger, np.int32,
np.int64,
np.byte, np.byte,
np.short, np.short,
np.intc, np.intc,
np.int_, np.int_,
np.longlong, np.longlong,
np.unsignedinteger, np.uint32,
np.uint64,
np.ubyte, np.ubyte,
np.ushort, np.ushort,
np.uintc, np.uintc,
np.uint, np.uint,
np.ulonglong, np.ulonglong,
np.floating, np.float16,
np.float32,
np.float64,
np.half, np.half,
np.single, np.single,
np.double, np.double,

View File

@ -328,5 +328,5 @@ class TestPandas:
return to_bytes(Xy) return to_bytes(Xy)
b0 = test_bool(pd.BooleanDtype()) b0 = test_bool(pd.BooleanDtype())
b1 = test_bool(np.bool) b1 = test_bool(bool)
assert b0 != b1 # None is converted to False with np.bool assert b0 != b1 # None is converted to False with np.bool