NVIDIA / NVIDIA/cudf

[BUG] Writing `NA`s in a view results in zeros in the parent dataframe

Open
#8,754 7 comments 0 reactions 1 assignee Assigned to @galipremsagar View on GitHub
bug Python
Dominant language
C++
Stars
9.8k
Forks
1.1k
Avg merge
3d 6m
Merged PRs (30d)
278

Description

I don't know exactly if it's a bug or a feature, but I have noticed that we don't have parity with pandas in the following example because `NA`s are interpreted as zeros when writing in the parent dataframe:

```python
import cudf
import pandas as pd

cudf0 = cudf.DataFrame([[1.], [2.]], columns=["A"])
cudf1 = cudf0[:1]
cudf1["A"] = None

print("cuDF (parent):")
print(cudf0, end='\n\n')
print("cuDF (view):")
print(cudf1, end='\n\n')

pd0 = pd.DataFrame([[1.], [2.]], columns=["A"])
pd1 = pd0[:1]
pd1["A"][0] = None

print("pandas (parent):")
print(pd0, end='\n\n')
print("pandas (view):")
print(pd1, end='\n\n')
```

Output:
```
cuDF (parent):
A
0 0.0
1 2.0

cuDF (view):
A
0

pandas (parent):
A
0 NaN
1 2.0

pandas (view):
A
0 NaN
```

Note that if we use the value `NaN` instead of `None` (aka missing value / ``), it works like pandas.

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.