Preserve categorical column index in DataFrame.describe and handle pure iterators in cudf.pandas fallback - #22821
Conversation
|
Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually. Contributors can view more details about this message here. |
DataFrame.describe and handle pure iterators in cudf.pandas fallback
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (3)
💤 Files with no reviewable changes (3)
📝 WalkthroughSummary by CodeRabbit
Walkthrough
ChangesDataFrame.describe column index preservation
Pure iterator handling in fast/slow proxy
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
/merge |
Description
This PR fixes two categorical-related issues in
cudf.pandasthat surfaced in the pandas groupby categorical test suite:DataFrame.describedropped the source column index.describebuilds its result withto_frame/concat, which discard the original column index (including its dtype and name, e.g. aCategoricalIndex). Sincedescribeproduces one column per described column in the same order, we now reassign the source column index onto the result.Pure iterators were passed to the slow path unwrapped in
fast_slow_proxy. Generators,map,filter,zip, andenumerateare resource-free but consumable iterators. On the fast path we continue to force a fallback (they can't be re-consumed). On the slow path, instead of handing the bare iterator straight to the slow library — which would pass wrapped proxies and lose type information (e.g.MultiIndex.from_productof amapover categoricals dropping thecategorydtype) — we now materialize and transform the elements, the same waylist/tupleargs are handled.Together these unblock the following previously-xfailed pandas tests, whose entries are removed from the pandas-testing plugin:
test_category_order_reducer(all/anyoverrange)test_describe_categorical_columnstest_observed[False]test_observed_codes_remap[False]test_observed_two_columns[False]test_unstack_categoricalChecklist