Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

convert all nulls to nans in a specific scenario #17677

Open
wants to merge 9 commits into
base: branch-25.02
Choose a base branch
from
4 changes: 4 additions & 0 deletions python/cudf/cudf/core/column/column.py
Original file line number Diff line number Diff line change
Expand Up @@ -2419,7 +2419,11 @@ def as_column(
and pa.types.is_integer(arbitrary.type)
and arbitrary.null_count > 0
):
# TODO: Need to re-visit this cast and fill_null
# calls while addressing the following issue:
# https://github.com/rapidsai/cudf/issues/14149
arbitrary = arbitrary.cast(pa.float64())
arbitrary = pc.fill_null(arbitrary, np.nan)
if (
cudf.get_option("default_integer_bitwidth")
and pa.types.is_integer(arbitrary.type)
Expand Down
11 changes: 10 additions & 1 deletion python/cudf/cudf/tests/test_series.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2020-2024, NVIDIA CORPORATION.
# Copyright (c) 2020-2025, NVIDIA CORPORATION.
import datetime
import decimal
import hashlib
Expand Down Expand Up @@ -3003,3 +3003,12 @@ def test_dtype_dtypes_equal():
ser = cudf.Series([0])
assert ser.dtype is ser.dtypes
assert ser.dtypes is ser.to_pandas().dtypes


def test_series_ensure_float_dtype():
with cudf.option_context("mode.pandas_compatible", True):
galipremsagar marked this conversation as resolved.
Show resolved Hide resolved
ser = cudf.Series([1, 2, np.nan, 10, None])
pser = pd.Series([1, 2, np.nan, 10, None])

assert pser.dtype == ser.dtype
assert_eq(ser, pser)
Loading