Skip to content

Commit

Permalink
Fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
hcho3 committed Apr 13, 2024
1 parent 7e1d1a9 commit fc12745
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 11 deletions.
5 changes: 3 additions & 2 deletions python-package/xgboost/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -915,8 +915,9 @@ def _transform_cudf_df(
from pandas.api.types import is_bool_dtype

# Work around https://github.com/dmlc/xgboost/issues/10181
if _is_cudf_ser(data) and is_bool_dtype(data.dtype):
data = data.astype(np.uint8)
if _is_cudf_ser(data):
if is_bool_dtype(data.dtype):
data = data.astype(np.uint8)
else:
data = data.astype(
{col: np.uint8 for col in data.select_dtypes(include="bool")}
Expand Down
9 changes: 0 additions & 9 deletions tests/python-gpu/test_from_cudf.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,6 @@ def _test_from_cudf(DMatrixT):
assert dtrain.num_col() == 1
assert dtrain.num_row() == 5

# Boolean is not supported.
X_boolean = cudf.DataFrame({"x": cudf.Series([True, False])})
with pytest.raises(Exception):
dtrain = DMatrixT(X_boolean)

y_boolean = cudf.DataFrame({"x": cudf.Series([True, False, True, True, True])})
with pytest.raises(Exception):
dtrain = DMatrixT(X_boolean, label=y_boolean)


def _test_cudf_training(DMatrixT):
import pandas as pd
Expand Down

0 comments on commit fc12745

Please sign in to comment.