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

Move unnecessary utilities from cudf._lib.scalar #17636

Open
wants to merge 6 commits into
base: branch-25.02
Choose a base branch
from

Conversation

mroeschke
Copy link
Contributor

@mroeschke mroeschke commented Dec 19, 2024

Description

In preparation for transitioning DeviceScalar to pylibcudf's Scalar, moving _is_null_host_scalar (a pure Python function) to cudf.utils.utils and removes as_device_scalar in favor of going through cudf.Scalar

Checklist

  • I am familiar with the Contributing Guidelines.
  • New or existing tests cover these changes.
  • The documentation is up to date with these changes.

@mroeschke mroeschke added Python Affects Python cuDF API. improvement Improvement / enhancement to an existing function non-breaking Non-breaking change labels Dec 19, 2024
@mroeschke mroeschke self-assigned this Dec 19, 2024
@mroeschke mroeschke requested a review from a team as a code owner December 19, 2024 20:17
@mroeschke mroeschke requested review from bdice and Matt711 December 19, 2024 20:17
Comment on lines 345 to 352
if is_na_like(slr):
return True
elif (
isinstance(slr, (np.datetime64, np.timedelta64)) and np.isnat(slr)
) or slr is pd.NaT:
return True
else:
return False
Copy link
Contributor

@bdice bdice Dec 20, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Try to combine this into something like:

return is_na_like(slr) or (isinstance(slr, (np.datetime64, np.timedelta64)) and np.isnat(slr) or slr is pd.NaT

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or if you leave it the long way, maybe add comments that help explain the second case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement Improvement / enhancement to an existing function non-breaking Non-breaking change Python Affects Python cuDF API.
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

2 participants