diff --git a/python-package/xgboost/data.py b/python-package/xgboost/data.py index a0505e9c9105..dbe0a66c8a74 100644 --- a/python-package/xgboost/data.py +++ b/python-package/xgboost/data.py @@ -745,11 +745,7 @@ def _from_cudf_df( def _is_cudf_ser(data: DataType) -> bool: - try: - import cudf - except ImportError: - return False - return isinstance(data, cudf.Series) + return lazy_isinstance(data, "cudf.core.series", "Series") def _is_cupy_array(data: DataType) -> bool: