From 26bafd02b7f37a3c20eeaa1fdc8d59e13015a57f Mon Sep 17 00:00:00 2001 From: Vyas Ramasubramani Date: Wed, 24 Mar 2021 12:29:57 -0700 Subject: [PATCH 1/2] Don't identify decimals as strings. --- python/cudf/cudf/utils/dtypes.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/python/cudf/cudf/utils/dtypes.py b/python/cudf/cudf/utils/dtypes.py index 8875a36dba8..67b54ef33f0 100644 --- a/python/cudf/cudf/utils/dtypes.py +++ b/python/cudf/cudf/utils/dtypes.py @@ -154,7 +154,11 @@ def is_numerical_dtype(obj): def is_string_dtype(obj): - return pd.api.types.is_string_dtype(obj) and not is_categorical_dtype(obj) + return ( + not is_decimal_dtype(obj) + and pd.api.types.is_string_dtype(obj) + and not is_categorical_dtype(obj) + ) def is_datetime_dtype(obj): From babcdfcfa9598eb4b20d458eb0d48a3ee035eedb Mon Sep 17 00:00:00 2001 From: Vyas Ramasubramani Date: Wed, 24 Mar 2021 17:10:53 -0700 Subject: [PATCH 2/2] Reject all extension types as string types. --- python/cudf/cudf/utils/dtypes.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/python/cudf/cudf/utils/dtypes.py b/python/cudf/cudf/utils/dtypes.py index 67b54ef33f0..8af225ecb58 100644 --- a/python/cudf/cudf/utils/dtypes.py +++ b/python/cudf/cudf/utils/dtypes.py @@ -155,9 +155,13 @@ def is_numerical_dtype(obj): def is_string_dtype(obj): return ( - not is_decimal_dtype(obj) - and pd.api.types.is_string_dtype(obj) + pd.api.types.is_string_dtype(obj) + # Reject all cudf extension types. and not is_categorical_dtype(obj) + and not is_decimal_dtype(obj) + and not is_list_dtype(obj) + and not is_struct_dtype(obj) + and not is_interval_dtype(obj) )