Add support for Pandas 3#2295
Open
kounelisagis wants to merge 10 commits into
Open
Conversation
ihnorton
reviewed
Feb 5, 2026
ihnorton
left a comment
Member
There was a problem hiding this comment.
LGTM overall but I'm nervous about the changes around string types (see inline) based on past experience.
|
|
||
| if col_dtypes: | ||
| df = df.astype(col_dtypes, copy=False) | ||
| # Use str instead of '<U0' so pandas uses its native string type |
Member
There was a problem hiding this comment.
Is our type-mapping wrong now? I don't quite follow why we need this change
Member
Author
There was a problem hiding this comment.
Added a comment in code.
1fe7c73 to
0886076
Compare
…ndling - _update_df_from_meta: casting to the zero-width '<U0'/'|S0' dtypes stored in the metadata breaks on pandas 3 (str columns turn into object, bytes into fixed-width '|S<n>' that cannot be used as an index). Replace it with an explicit bytes<->str conversion restoring the type the dimension was written with, and skip no-op casts so that dropping `copy=False` (removed in pandas 3) does not introduce extra copies on pandas 2. - ColumnInfo: distinguish the two StringDtype variants by `na_value` (per the pandas migration guide) and reuse from_dtype in from_values instead of duplicating the mapping. - _df_to_np_arrays: restore unconditional nullmap creation; the data scan guard was unnecessary and the explicit vectorized nullmap is cheaper than the per-element fallback in the write path. - Add a str/bytes dimension .df roundtrip regression test covering both the arrow and non-arrow read paths.
0886076 to
1fd0968
Compare
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.
This PR adds Pandas 3 support while maintaining Pandas 2 compatibility. The main change is handling the new
StringDtypethat Pandas 3 uses by default for strings.Also, added a CI step to continue on running tests using Pandas 2.
Closes CORE-487