diff --git a/python-package/xgboost/data.py b/python-package/xgboost/data.py index b29eac7959f3..9491efd1c38c 100644 --- a/python-package/xgboost/data.py +++ b/python-package/xgboost/data.py @@ -317,7 +317,7 @@ def _is_cudf_df(data): import cudf except ImportError: return False - return isinstance(data, cudf.DataFrame) + return hasattr(cudf, 'DataFrame') and isinstance(data, cudf.DataFrame) def _cudf_array_interfaces(data):