Fix string reductions and isin across string dtype flavors - #23214
Merged
rapids-bot[bot] merged 4 commits intoJul 13, 2026
Merged
Fix string reductions and isin across string dtype flavors#23214rapids-bot[bot] merged 4 commits into
rapids-bot[bot] merged 4 commits into
Conversation
- StringColumn.sum on an empty or all-null series returns the additive identity: 0 for object dtype, "" for string dtypes, matching pandas. - _get_nan_for_dtype returns the dtype's exact na_value singleton for pd.StringDtype and arrow string dtypes so reductions like min/max(skipna=False) satisfy `result is dtype.na_value`. Other kind-"O" extension dtypes (categorical, arrow decimal/binary) keep the float NaN fallback that pandas' skew/cov/corr coercion matches. - StringColumn._process_values_for_isin aligns string-typed values with the column's dtype so isin matches element values across all string dtype flavors instead of returning all-False on flavor mismatch. - cudf.pandas _transform_arg returns object-dtype ndarrays as-is when no element needed transforming, preserving buffer identity for aliasing checks such as np.may_share_memory; fixes "ValueError: array is read-only" from numpy Generator.permutation on string Series under pandas copy-on-write. - Remove 21 pandas-testing plugin entries that now pass. - Add classic tests covering object dtype, all four pd.StringDtype flavors, and pd.ArrowDtype string/large_string, plus cudf.pandas tests for the ndarray identity fix.
|
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 (1)
💤 Files with no reviewable changes (1)
📝 WalkthroughSummary by CodeRabbit
WalkthroughUpdates nullable result handling, string reductions and ChangesString dtype and proxy behavior alignment
Estimated code review effort: 3 (Moderate) | ~25 minutes Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Contributor
Author
|
/okay to test 6a4d6ae |
CI's full-suite run surfaced four strict XPASSes beyond the files swept locally: the copy_view test_series_array_string_dtype parametrizations pass due to the _transform_arg ndarray identity fix (np.shares_memory(np.asarray(ser), ser.values) now holds), and test_replace_categorical_ea_dtype_different_cats_raises passes due to the isin dtype alignment fix.
Contributor
Author
|
/okay to test c581ad2 |
mroeschke
approved these changes
Jul 13, 2026
Contributor
Author
|
/merge |
This was referenced Jul 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes several string-dtype behaviors to match pandas across all string dtype flavors (
object, the fourpd.StringDtypestorage/na_value combinations, andpd.ArrowDtypestring types), plus acudf.pandasproxy fix. These resolve 21 xfailed pandas unit tests in the pandas-testing plugin.StringColumn.sumempty identity: summing an empty or all-null series now returns the additive identity —0for object dtype,""for string dtypes — matching pandas (tests/arrays/string_/test_string.py::test_reduce_empty).min/maxNA sentinel identity:_get_nan_for_dtypereturns the dtype's exactna_valuesingleton forpd.StringDtypeand arrow string dtypes, somin/max(skipna=False)satisfiesresult is dtype.na_value(pd.NAfor"string"dtypes andArrowDtype, thenp.nanfloat singleton for"str"dtypes). Other kind-"O"extension dtypes (categorical, arrow decimal/binary) intentionally keep the float NaN fallback, since pandas coerces theirskew/cov/corrresults to a float NaN.isinacross string dtype flavors:StringColumn._process_values_for_isinaligns string-typedvalueswith the column's dtype (mirroring the numeric override), soisinmatches on element values instead of returning all-False when the flavor differs.cudf.pandasobject-ndarray identity:_transform_argreturns an object-dtype ndarray as-is when no element needed transforming. Rebuilding an equivalent copy broke aliasing checks such asnp.may_share_memory(np.asarray(x), x), whichnumpy.random.Generator.permutationuses to decide whether to defensively copy before an in-place shuffle — under pandas copy-on-write this raisedValueError: array is read-only.Test coverage added:
tests/series/methods/test_reductions.pyandtests/series/methods/test_isin.py, parametrized overobjectdtype, all fourpd.StringDtypeflavors, andpd.ArrowDtype(pa.string())/pa.large_string(), comparing against pandas wherever pandas does not raise or diverge (divergences are documented inline).cudf.pandastests: a_transform_argidentity unit test and an end-to-endGenerator.permutationtest validated against real pandas with the same seed.Checklist