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

Change NA to NaT for datetime and timedelta types #13868

Merged
merged 14 commits into from
Aug 14, 2023

Conversation

galipremsagar
Copy link
Contributor

@galipremsagar galipremsagar commented Aug 12, 2023

Description

Resolves: #13867

This PR:

  • Changes all repr code of datetime & timdelta types to switch to represent null values as NaT from <NA>.
  • Changes Scalar getitem to return cudf.NaT instead of cudf.NA

Checklist

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

@galipremsagar galipremsagar requested a review from a team as a code owner August 12, 2023 20:58
@galipremsagar galipremsagar requested review from bdice and isVoid August 12, 2023 20:58
@github-actions github-actions bot added the Python Affects Python cuDF API. label Aug 12, 2023
@galipremsagar galipremsagar changed the title Change NA to NaT for datetime and timedelta types Change NA to NaT for datetime and timedelta types Aug 12, 2023
@galipremsagar galipremsagar self-assigned this Aug 12, 2023
@galipremsagar galipremsagar added improvement Improvement / enhancement to an existing function breaking Breaking change labels Aug 12, 2023
@galipremsagar galipremsagar marked this pull request as draft August 12, 2023 21:55
@galipremsagar galipremsagar marked this pull request as ready for review August 13, 2023 01:38
Copy link
Contributor

@bdice bdice left a comment

Choose a reason for hiding this comment

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

This looks good overall. I'm a little surprised the changeset isn't larger than this. I would like to think about refactoring the ways we check if values are "None, NA, NaT"-like. I understand it might vary by the calling code, but we might be able to reduce repeated logic a little. If you don't see an opportunity to improve that, I am fine with accepting this PR as-is.

python/cudf/cudf/_lib/scalar.pyx Outdated Show resolved Hide resolved
python/cudf/cudf/core/column/column.py Outdated Show resolved Hide resolved
@galipremsagar
Copy link
Contributor Author

This looks good overall. I'm a little surprised the changeset isn't larger than this. I would like to think about refactoring the ways we check if values are "None, NA, NaT"-like. I understand it might vary by the calling code, but we might be able to reduce repeated logic a little. If you don't see an opportunity to improve that, I am fine with accepting this PR as-is.

I was able to add is_na_like utility and replaced all such repetitive patterns.

@galipremsagar galipremsagar requested a review from bdice August 14, 2023 15:11
python/cudf/cudf/core/dataframe.py Outdated Show resolved Hide resolved
python/cudf/cudf/utils/dtypes.py Outdated Show resolved Hide resolved
python/cudf/cudf/utils/dtypes.py Show resolved Hide resolved
python/cudf/cudf/tests/test_repr.py Outdated Show resolved Hide resolved
python/cudf/cudf/core/series.py Outdated Show resolved Hide resolved
@galipremsagar galipremsagar requested a review from bdice August 14, 2023 18:57
Copy link
Contributor

@bdice bdice left a comment

Choose a reason for hiding this comment

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

Great! Thanks for the iterations.

python/cudf/cudf/__init__.py Outdated Show resolved Hide resolved
@galipremsagar galipremsagar added the 5 - Ready to Merge Testing and reviews complete, ready to merge label Aug 14, 2023
@galipremsagar
Copy link
Contributor Author

/merge

@rapids-bot rapids-bot bot merged commit b768270 into rapidsai:branch-23.10 Aug 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
5 - Ready to Merge Testing and reviews complete, ready to merge breaking Breaking change improvement Improvement / enhancement to an existing function Python Affects Python cuDF API.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FEA] Change NA to NaT for timedelta & datetime types
2 participants