Skip to content

Fix to_array to return non-corrupted data#22342

Merged
rapids-bot[bot] merged 7 commits into
rapidsai:mainfrom
galipremsagar:to_array
May 6, 2026
Merged

Fix to_array to return non-corrupted data#22342
rapids-bot[bot] merged 7 commits into
rapidsai:mainfrom
galipremsagar:to_array

Conversation

@galipremsagar
Copy link
Copy Markdown
Contributor

Description

Fixes #22136

This PR gueared the homogeneous numeric DataFrame.to_cupy fast path so it only uses table_to_array when dtype is None or exactly matches the source column dtype.

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 self-assigned this Apr 30, 2026
@galipremsagar galipremsagar requested a review from a team as a code owner April 30, 2026 19:52
@galipremsagar galipremsagar added bug Something isn't working 3 - Ready for Review Ready for review by team Python Affects Python cuDF API. non-breaking Non-breaking change labels Apr 30, 2026
@galipremsagar galipremsagar requested a review from vyasr April 30, 2026 19:52
@GPUtester GPUtester moved this to In Progress in cuDF Python Apr 30, 2026
Comment thread python/cudf/cudf/core/frame.py Outdated
Co-authored-by: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com>
@galipremsagar galipremsagar requested a review from mroeschke May 4, 2026 14:50
@galipremsagar
Copy link
Copy Markdown
Contributor Author

pre-commit.ci autofix

@copy-pr-bot
Copy link
Copy Markdown

copy-pr-bot Bot commented May 6, 2026

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@galipremsagar galipremsagar added 5 - Ready to Merge Testing and reviews complete, ready to merge and removed 3 - Ready for Review Ready for review by team labels May 6, 2026
@galipremsagar
Copy link
Copy Markdown
Contributor Author

/okay to test 9c1ea79

@galipremsagar
Copy link
Copy Markdown
Contributor Author

/merge

@galipremsagar
Copy link
Copy Markdown
Contributor Author

/okay to test d56651c

@rapids-bot rapids-bot Bot merged commit 41be396 into rapidsai:main May 6, 2026
119 checks passed
@github-project-automation github-project-automation Bot moved this from In Progress to Done in cuDF Python May 6, 2026
galipremsagar added a commit to galipremsagar/cudf that referenced this pull request May 8, 2026
Fixes rapidsai#22136

This PR gueared the homogeneous numeric `DataFrame.to_cupy` fast path  so it only uses `table_to_array` when `dtype` is `None` or exactly matches the source column `dtype`.

Authors:
  - GALI PREM SAGAR (https://github.com/galipremsagar)
  - https://github.com/apps/pre-commit-ci

Approvers:
  - Matthew Roeschke (https://github.com/mroeschke)

URL: rapidsai#22342
shrshi pushed a commit to shrshi/cudf that referenced this pull request May 12, 2026
Fixes rapidsai#22136

This PR gueared the homogeneous numeric `DataFrame.to_cupy` fast path  so it only uses `table_to_array` when `dtype` is `None` or exactly matches the source column `dtype`.

Authors:
  - GALI PREM SAGAR (https://github.com/galipremsagar)
  - https://github.com/apps/pre-commit-ci

Approvers:
  - Matthew Roeschke (https://github.com/mroeschke)

URL: rapidsai#22342
rapids-bot Bot pushed a commit that referenced this pull request May 14, 2026
Fixes #22136

Follow-up to #22342. Cast at the cudf column level when an explicit `dtype` differs from the source column's dtype, so `s.to_cupy(dtype=X)` matches `s.astype(X).to_cupy()` for string, datetime, bool, and other non-numeric sources (instead of raising `cupy does not support object`).

Authors:
  - GALI PREM SAGAR (https://github.com/galipremsagar)

Approvers:
  - Matthew Murray (https://github.com/Matt711)

URL: #22485
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 bug Something isn't working non-breaking Non-breaking change Python Affects Python cuDF API.

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

[BUG] to_cupy(dtype=...) fails or gives wrong results

3 participants