Skip to content

Replace cudf.Series.values_host with .to_numpy().#7772

Merged
rapids-bot[bot] merged 2 commits intorapidsai:mainfrom
csadorf:fix/replace-cudf-series-values_host-with-to_numpy
Feb 6, 2026
Merged

Replace cudf.Series.values_host with .to_numpy().#7772
rapids-bot[bot] merged 2 commits intorapidsai:mainfrom
csadorf:fix/replace-cudf-series-values_host-with-to_numpy

Conversation

@csadorf
Copy link
Copy Markdown
Contributor

@csadorf csadorf commented Feb 6, 2026

Fixes #7771

@csadorf csadorf requested a review from a team as a code owner February 6, 2026 15:59
@csadorf csadorf requested a review from dantegd February 6, 2026 15:59
@github-actions github-actions Bot added the Cython / Python Cython or Python issue label Feb 6, 2026
Copy link
Copy Markdown
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.

Approving with one question.

Comment thread python/cuml/cuml/dask/neighbors/kneighbors_classifier.py Outdated
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Feb 6, 2026

📝 Walkthrough

Summary by CodeRabbit

  • Bug Fixes

    • Improved data conversion compatibility across CPU/GPU backends, fixing issues in label/target encoding, one-hot handling, and k‑nearest classifier workflows.
  • Chores

    • Standardized internal data extraction in utilities and tests to use a unified NumPy conversion path for more reliable cross-backend behavior.

Walkthrough

Replaced usages of the deprecated cuDF values_host attribute with the standard to_numpy() (and cp.asnumpy() for CuPy) across preprocessing, neighbors, testing utilities, and tests to ensure consistent array extraction without changing control flow or public method signatures.

Changes

Cohort / File(s) Summary
Preprocessing
python/cuml/cuml/preprocessing/LabelEncoder.py, python/cuml/cuml/preprocessing/TargetEncoder.py, python/cuml/cuml/preprocessing/encoders.py
Replaced .values_host accesses with .to_numpy() when converting cuDF Series to NumPy arrays (inverse_transform, fit-transform median path, and feature name generation).
Neighbors (dask)
python/cuml/cuml/dask/neighbors/kneighbors_classifier.py
Unified unique-label extraction to use .to_numpy() for pandas/cuDF Series and cp.asnumpy() for CuPy arrays; removed cuDF-specific values_host branch.
Testing utilities
python/cuml/cuml/testing/utils.py
from_df_to_numpy() non-DataFrame branch now uses .to_numpy() instead of .values_host for column conversion.
Tests
python/cuml/tests/test_one_hot_encoder.py, python/cuml/tests/test_train_test_split.py
Replaced .values_host with .to_numpy() in test conversions and comparisons; minor copyright year update in one test.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 75.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: replacing cudf.Series.values_host with .to_numpy().
Description check ✅ Passed The description references the linked issue #7771, which directly relates to the changeset addressing the cuDF values_host deprecation.
Linked Issues check ✅ Passed All code changes systematically replace .values_host with .to_numpy() across multiple files, directly addressing the requirement in issue #7771 to prevent FutureWarning failures.
Out of Scope Changes check ✅ Passed All changes are scoped to replacing .values_host with .to_numpy() as required; only incidental copyright year update in test file is present.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@csadorf csadorf added bug Something isn't working non-breaking Non-breaking change labels Feb 6, 2026
@csadorf
Copy link
Copy Markdown
Contributor Author

csadorf commented Feb 6, 2026

/merge

@rapids-bot rapids-bot Bot merged commit cb13f32 into rapidsai:main Feb 6, 2026
166 of 168 checks passed
@csadorf csadorf deleted the fix/replace-cudf-series-values_host-with-to_numpy branch February 6, 2026 17:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working Cython / Python Cython or Python issue non-breaking Non-breaking change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[CI] values_host deprecation (cudf) causes FutureWarning / test failures

4 participants