Skip to content

Commit

Permalink
Emit an error.
Browse files Browse the repository at this point in the history
  • Loading branch information
trivialfis committed Sep 13, 2021
1 parent afb875f commit 7b629f3
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions python-package/xgboost/data.py
Expand Up @@ -332,6 +332,7 @@ def _transform_dt_df(
data,
feature_names: Optional[List[str]],
feature_types: Optional[List[str]],
enable_categorical: bool,
meta=None,
meta_type=None,
):
Expand All @@ -345,6 +346,9 @@ def _transform_dt_df(
data = data.to_numpy()[:, 0].astype(meta_type)
return data, None, None

if enable_categorical:
raise ValueError("Categorical data is not supported for datatable yet.")

data_types_names = tuple(lt.name for lt in data.ltypes)
bad_fields = [data.names[i]
for i, type_name in enumerate(data_types_names)
Expand Down Expand Up @@ -378,7 +382,8 @@ def _from_dt_df(
if enable_categorical:
raise ValueError("categorical data in datatable is not supported yet.")
data, feature_names, feature_types = _transform_dt_df(
data, feature_names, feature_types, None, None)
data, feature_names, feature_types, enable_categorical, None, None
)

ptrs = (ctypes.c_void_p * data.ncols)()
if hasattr(data, "internal") and hasattr(data.internal, "column"):
Expand Down Expand Up @@ -804,7 +809,7 @@ def _meta_from_cupy_array(data, field, handle):


def _meta_from_dt(data, field, dtype, handle):
data, _, _ = _transform_dt_df(data, None, None)
data, _, _ = _transform_dt_df(data, None, None, False)
_meta_from_numpy(data, field, dtype, handle)


Expand Down

0 comments on commit 7b629f3

Please sign in to comment.