From 38ad168285fb6d8a7c28c8c0326a8df09f9daa3f Mon Sep 17 00:00:00 2001 From: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com> Date: Tue, 26 Nov 2024 19:12:50 -0800 Subject: [PATCH] Fix bugs --- python/cudf/cudf/core/column/string.py | 5 ++--- python/cudf/cudf/core/tools/numeric.py | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/python/cudf/cudf/core/column/string.py b/python/cudf/cudf/core/column/string.py index 8e90b0c4fc6..5a37af68eed 100644 --- a/python/cudf/cudf/core/column/string.py +++ b/python/cudf/cudf/core/column/string.py @@ -5948,7 +5948,7 @@ def __contains__(self, item: ScalarLike) -> bool: def as_numerical_column(self, dtype: Dtype) -> NumericalColumn: out_dtype = cudf.api.types.dtype(dtype) - if out_dtype == "b": + if out_dtype.kind == "b": with acquire_spill_lock(): plc_column = plc.strings.attributes.count_characters( self.to_pylibcudf(mode="read") @@ -6024,11 +6024,10 @@ def strptime( add_back_nat = False with acquire_spill_lock(): - plc_dtype = dtype_to_pylibcudf_type(self.dtype) + plc_dtype = dtype_to_pylibcudf_type(dtype) result_col = type(self).from_pylibcudf( casting_func(self.to_pylibcudf(mode="read"), plc_dtype, format) ) - result_col = casting_func(self, dtype, format) if add_back_nat: result_col[is_nat] = None diff --git a/python/cudf/cudf/core/tools/numeric.py b/python/cudf/cudf/core/tools/numeric.py index ab414b2eebd..caf0e537e09 100644 --- a/python/cudf/cudf/core/tools/numeric.py +++ b/python/cudf/cudf/core/tools/numeric.py @@ -231,9 +231,9 @@ def _convert_str_col(col, errors, _downcast=None): return col.astype(dtype=cudf.dtype("float64")) else: if errors == "coerce": - col = col.astype(np.dtype(np.float64)) non_numerics = is_float.unary_operator("not") col[non_numerics] = None + col = col.astype(np.dtype(np.float64)) return col else: raise ValueError("Unable to convert some strings to numerics.")