Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions python/cuml/tests/test_metrics.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# SPDX-FileCopyrightText: Copyright (c) 2021-2025, NVIDIA CORPORATION.
# SPDX-FileCopyrightText: Copyright (c) 2021-2026, NVIDIA CORPORATION.
# SPDX-License-Identifier: Apache-2.0
#

Expand Down Expand Up @@ -203,7 +203,13 @@ def convert(x, kind, dtype):
if kind == "cupy":
return cp.array(x, dtype=dtype)
elif kind == "cudf":
return cudf.Series(x).astype(dtype)
s = cudf.Series(x)
# cudf no longer accepts "str" as a valid dtype argument to astype().
# When input is already string data, cudf.Series() creates the
# correct string dtype automatically.
if dtype == "str":
return s
return s.astype(dtype)
else:
return x

Expand Down