Skip to content

Add support for Pandas 3#2295

Open
kounelisagis wants to merge 10 commits into
mainfrom
agis/pandas3-support
Open

Add support for Pandas 3#2295
kounelisagis wants to merge 10 commits into
mainfrom
agis/pandas3-support

Conversation

@kounelisagis

@kounelisagis kounelisagis commented Feb 5, 2026

Copy link
Copy Markdown
Member

This PR adds Pandas 3 support while maintaining Pandas 2 compatibility. The main change is handling the new StringDtype that Pandas 3 uses by default for strings.

Also, added a CI step to continue on running tests using Pandas 2.

Closes CORE-487

@kounelisagis kounelisagis marked this pull request as ready for review February 5, 2026 16:38
@kounelisagis kounelisagis requested a review from ihnorton February 5, 2026 16:55

@ihnorton ihnorton left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM overall but I'm nervous about the changes around string types (see inline) based on past experience.

Comment thread tiledb/multirange_indexing.py Outdated

if col_dtypes:
df = df.astype(col_dtypes, copy=False)
# Use str instead of '<U0' so pandas uses its native string type

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is our type-mapping wrong now? I don't quite follow why we need this change

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a comment in code.

Comment thread tiledb/tests/test_pandas_dataframe.py Outdated
Comment thread tiledb/dataframe_.py
@kounelisagis kounelisagis force-pushed the agis/pandas3-support branch from 1fe7c73 to 0886076 Compare July 7, 2026 11:50
…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.
@kounelisagis kounelisagis force-pushed the agis/pandas3-support branch from 0886076 to 1fd0968 Compare July 7, 2026 11:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants