NVIDIA / NVIDIA/cudf

[BUG] `.to_pandas` from booleans with missing values returns `None` instead of `np.nan`

Open
#20,901 0 comments 0 reactions 0 assignees View on GitHub
bug Python
Dominant language
C++
Stars
9.8k
Forks
1.1k
Avg merge
3d 6m
Merged PRs (30d)
278

Description

**Steps/Code to reproduce bug**
xref https://github.com/rapidsai/cudf/pull/20899#discussion_r2628899171

```
In [1]: import cudf

In [2]: cudf.Series([True, float("nan"), False], nan_as_null=True).to_pandas()
Out[2]:
0 True
1 None
2 False
dtype: object

In [3]: import pandas as pd

In [4]: pd.Series([True, False]).reindex([0, 1, 2])
Out[4]:
0 True
1 False
2 NaN
dtype: object
```

**Expected behavior**
While pandas still does recognize `None` as a missing value for bool data, `np.nan` is the more canonical missing value.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.