@@ -835,6 +835,16 @@ def _is_cudf_df(data: DataType) -> bool:
835
835
return lazy_isinstance (data , "cudf.core.dataframe" , "DataFrame" )
836
836
837
837
838
+ def _is_cudf_pandas (data : DataType ) -> bool :
839
+ """Must go before both pandas and cudf checks."""
840
+ return (
841
+ lazy_isinstance (data , "pandas.core.frame" , "DataFrame" )
842
+ or lazy_isinstance (data , "pandas.core.series" , "Series" )
843
+ ) and lazy_isinstance (
844
+ type (data ), "cudf.pandas.fast_slow_proxy" , "_FastSlowProxyMeta"
845
+ )
846
+
847
+
838
848
def _get_cudf_cat_predicate () -> Callable [[Any ], bool ]:
839
849
try :
840
850
from cudf import CategoricalDtype
@@ -1187,6 +1197,8 @@ def dispatch_data_backend(
1187
1197
)
1188
1198
if _is_arrow (data ):
1189
1199
data = _arrow_transform (data )
1200
+ if _is_cudf_pandas (data ):
1201
+ data = data ._fsproxy_fast # pylint: disable=protected-access
1190
1202
if _is_pandas_series (data ):
1191
1203
import pandas as pd
1192
1204
@@ -1327,6 +1339,8 @@ def dispatch_meta_backend(
1327
1339
return
1328
1340
if _is_arrow (data ):
1329
1341
data = _arrow_transform (data )
1342
+ if _is_cudf_pandas (data ):
1343
+ data = data ._fsproxy_fast # pylint: disable=protected-access
1330
1344
if _is_pandas_df (data ):
1331
1345
_meta_from_pandas_df (data , name , dtype = dtype , handle = handle )
1332
1346
return
@@ -1398,6 +1412,8 @@ def _proxy_transform(
1398
1412
feature_types : Optional [FeatureTypes ],
1399
1413
enable_categorical : bool ,
1400
1414
) -> TransformedData :
1415
+ if _is_cudf_pandas (data ):
1416
+ data = data ._fsproxy_fast # pylint: disable=protected-access
1401
1417
if _is_cudf_df (data ) or _is_cudf_ser (data ):
1402
1418
return _transform_cudf_df (
1403
1419
data , feature_names , feature_types , enable_categorical
0 commit comments