Skip to content

Fix falsy Grouper key and level handling - #24225

Open
fallintoplace wants to merge 1 commit into
NVIDIA:mainfrom
fallintoplace:fix/falsy-grouper-selectors
Open

fallintoplace wants to merge 1 commit into
NVIDIA:mainfrom
fallintoplace:fix/falsy-grouper-selectors

Conversation

@fallintoplace

Copy link
Copy Markdown
Contributor

What

  • Check Grouper key and level selectors against None.
  • Keep empty-string keys and level 0 on their intended paths.

Why

  • Truthiness checks skip valid key="" and level=0 values.

Tests

  • Add resampling coverage for on="" and level=0.
  • Add groupby coverage for Grouper(key="").
  • Applicable pre-commit checks pass.

@fallintoplace
fallintoplace requested a review from a team as a code owner September 18, 2026 09:21
@copy-pr-bot

copy-pr-bot Bot commented Sep 18, 2026

Copy link
Copy Markdown

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.

@github-actions github-actions Bot added the Python Affects Python cuDF API. label Sep 18, 2026
@coderabbitai

coderabbitai Bot commented Sep 18, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 4a9f1482-b164-4426-adeb-28a4179ce7f5

📥 Commits

Reviewing files that changed from the base of the PR and between 9a601e2 and b3fb5ee.

📒 Files selected for processing (4)
  • python/cudf/cudf/core/groupby/groupby.py
  • python/cudf/cudf/core/resample.py
  • python/cudf/cudf/tests/groupby/test_reductions.py
  • python/cudf/cudf/tests/groupby/test_resample.py

Included review availability: Your plan provides up to 12 included reviews per hour; 8 remain after this review.


📝 Summary

Summary by CodeRabbit

  • Bug Fixes

    • Fixed grouping with empty-string column names.
    • Fixed resampling when using empty labels or the first level of a MultiIndex.
    • Improved consistency with pandas for grouping and daily resampling results.
  • Tests

    • Added coverage for empty column names, empty grouping keys, and MultiIndex-based resampling.

Walkthrough

Changes

The grouper and resample paths now treat non-None keys and levels as explicitly provided. New tests cover empty column names and MultiIndex level-based resampling.

Grouper routing

Layer / File(s) Summary
Preserve explicit grouper values
python/cudf/cudf/core/groupby/groupby.py, python/cudf/cudf/core/resample.py
Groupby and resample routing now uses None checks instead of truthiness checks for keys and levels.
Validate falsey and level-based grouping
python/cudf/cudf/tests/groupby/test_reductions.py, python/cudf/cudf/tests/groupby/test_resample.py
Tests compare pandas and cuDF results for an empty-string column name and MultiIndex level-zero resampling.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Merge Risk: ⚪ Minimal · up to b3fb5

The change fixes empty-string and level-zero Grouper handling without an established regression, and the affected paths have pandas-parity coverage.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 9 functions across 4 files. 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 identifies the main change: fixing handling for falsy Grouper keys and levels.
Description check ✅ Passed The description accurately explains the None checks, affected falsy values, rationale, and added tests.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Create a new PR

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

@mroeschke

Copy link
Copy Markdown
Contributor

/ok to test b3fb5ee

@mroeschke mroeschke added bug Something isn't working non-breaking Non-breaking change labels Sep 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working non-breaking Non-breaking change Python Affects Python cuDF API.

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

2 participants