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

[FEA] Match pandas behavior for comparisons involving true nulls #7066

Closed
brandon-b-miller opened this issue Jan 4, 2021 · 3 comments · Fixed by #7490
Closed

[FEA] Match pandas behavior for comparisons involving true nulls #7066

brandon-b-miller opened this issue Jan 4, 2021 · 3 comments · Fixed by #7490
Assignees
Labels
feature request New feature or request Python Affects Python cuDF API.

Comments

@brandon-b-miller
Copy link
Contributor

Is your feature request related to a problem? Please describe.
Nulls should propagate through comparisons the same way they do in Pandas. Any kind of comparison operation where <NA> is one of the operands should yield <NA>. This is not currently so in cuDF:

>>> cudf.Series([1,2,3]) > cudf.Series([1,2,None])
0    False
1    False
2    False
dtype: bool

What we should have is:

>>> pd.Series([1,2,pd.NA], dtype='Int64') < pd.NA
0    <NA>
1    <NA>
2    <NA>
dtype: boolean

Describe the solution you'd like
For all comparison operations, the mask of the resulting series should be the result of an elementwise logical or between the masks. I believe this is true in libcudf, and suspect we originally went a different way to match pandas nan logic instead of true null. The same thing should work with cudf.NA.

Describe alternatives you've considered

Additional context
xref : issue #7043

@brandon-b-miller brandon-b-miller added feature request New feature or request Python Affects Python cuDF API. labels Jan 4, 2021
@brandon-b-miller brandon-b-miller self-assigned this Jan 4, 2021
@jrhemstad
Copy link
Contributor

suspect we originally went a different way to match pandas nan logic instead of true null.

I think this is the crux of it. Pandas until recently didn't have true nulls and everything was hacky using floats/NaN.

Not only does the proposed null logic make more sense, it's also higher performance because it doesn't require additional kernels/allocations to replace nulls w/ False.

rapids-bot bot pushed a commit that referenced this issue Jan 19, 2021
Fixes #7043, gives less than ideal results due to #7066.

Authors:
  - brandon-b-miller <[email protected]>

Approvers:
  - GALI PREM SAGAR (@galipremsagar)

URL: #7072
@github-actions
Copy link

This issue has been marked stale due to no recent activity in the past 30d. Please close this issue if no further response or action is needed. Otherwise, please respond with a comment indicating any updates or changes to the original issue and/or confirm this issue still needs to be addressed. This issue will be marked rotten if there is no activity in the next 60d.

@brandon-b-miller
Copy link
Contributor Author

This is getting fixed this release (0.19)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature or request Python Affects Python cuDF API.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants