Skip to content

[WIP] Support pandas 3.x#13812

Draft
lukasmasuch wants to merge 3 commits intodevelopfrom
lukasmasuch/pandas-3-support
Draft

[WIP] Support pandas 3.x#13812
lukasmasuch wants to merge 3 commits intodevelopfrom
lukasmasuch/pandas-3-support

Conversation

@lukasmasuch
Copy link
Collaborator

@lukasmasuch lukasmasuch commented Feb 4, 2026

Describe your changes

Update pandas dependency upper bound from <3 to <4 to support pandas 3.0 and later versions. Streamlit's codebase is already fully compatible with pandas 3.x, including all breaking changes such as Copy-on-Write semantics, string dtype inference, and datetime resolution changes.

Github Issues

Testing Plan

  • All 8072 Python unit tests pass with pandas 3.0.0
  • Type checking (mypy and ty) passes
  • All lint and format checks pass
  • No code changes were needed; the existing codebase handles all pandas 3.x breaking changes

Contribution License Agreement

By submitting this pull request you agree that all contributions to this project are made under the Apache 2.0 license.

Update pandas upper bound from <3 to <4 to support pandas 3.0 and later versions. Streamlit's codebase is already fully compatible with pandas 3.x breaking changes including Copy-on-Write semantics, string dtype inference, and datetime resolution changes.

Co-Authored-By: Claude (claude-haiku-4-5) <noreply@anthropic.com>
@lukasmasuch lukasmasuch requested a review from a team as a code owner February 4, 2026 02:22
Copilot AI review requested due to automatic review settings February 4, 2026 02:22
@snyk-io
Copy link
Contributor

snyk-io bot commented Feb 4, 2026

Snyk checks have passed. No issues have been found so far.

Status Scanner Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@github-actions
Copy link
Contributor

github-actions bot commented Feb 4, 2026

✅ PR preview is ready!

Name Link
📦 Wheel file https://core-previews.s3-us-west-2.amazonaws.com/pr-13812/streamlit-1.53.1-py3-none-any.whl
📦 @streamlit/component-v2-lib Download from artifacts
🕹️ Preview app pr-13812.streamlit.app (☁️ Deploy here if not accessible)

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the pandas dependency to support pandas 3.x by changing the upper bound from <3 to <4. The existing Streamlit codebase is already fully compatible with all pandas 3.x breaking changes, including Copy-on-Write semantics, string dtype inference, and datetime resolution changes.

Changes:

  • Updated pandas dependency upper bound from <3 to <4 in lib/pyproject.toml

@lukasmasuch lukasmasuch added security-assessment-completed Security assessment has been completed for PR change:feature PR contains new feature or enhancement implementation impact:users PR changes affect end users labels Feb 4, 2026
lukasmasuch and others added 2 commits February 4, 2026 13:17
This commit addresses various compatibility issues with pandas 3.x:

- Update hashing.py: Use regex patterns to match both pandas 2.x
  (`pandas.core.frame.DataFrame`) and pandas 3.x (`pandas.DataFrame`)
  type paths for DataFrame and Series hashing.

- Update metrics_util.py: Add pandas 3.x type paths to the object
  name mapping since pandas 3.x changed __module__ from `pandas.core.*`
  to `pandas.*`.

- Update column_config_utils.py: Handle `large_string` PyArrow type
  which pandas 3.x uses for string columns instead of `string`.

- Update map.py: Convert string columns to object dtype before
  mapping color values to tuples, since pandas 3.x StringDtype
  cannot hold tuple values.

- Update test files: Handle pandas 3.x behavior where string columns
  use NA instead of None, and use flexible type checks for PyArrow
  arrays which may be StringArray or LargeStringArray.

- Update CI workflow: Add step to upgrade pandas to latest version
  for Python >= 3.11 (pandas 3.x requires Python >= 3.11), with
  UV_NO_SYNC=1 to prevent downgrade during uv run commands.

- Add pydeck test skip: Skip pydeck-related tests on pandas 3.x due
  to upstream pydeck incompatibility (vars() on DataFrame issue).

Co-Authored-By: Claude (claude-opus-4-5) <noreply@anthropic.com>
Add _prepare_pydeck_for_json() function that converts pandas DataFrames
in pydeck layers to lists of dicts before JSON serialization. This works
around a pandas 3.x issue where DataFrames no longer have a __dict__
attribute that vars() can access, which breaks pydeck's default_serialize
function in json_tools.py.

This removes the need to skip pydeck tests on pandas 3.x.

Co-Authored-By: Claude (claude-opus-4-5) <noreply@anthropic.com>
@lukasmasuch
Copy link
Collaborator Author

We might want to wait for pydeck to resolve this pandas 3 issue: visgl/deck.gl#9986

@lukasmasuch lukasmasuch marked this pull request as draft February 4, 2026 12:55
@lukasmasuch lukasmasuch marked this pull request as draft February 4, 2026 12:55
@lukasmasuch lukasmasuch changed the title Support pandas 3.x [WIP] Support pandas 3.x Feb 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

change:feature PR contains new feature or enhancement implementation impact:users PR changes affect end users security-assessment-completed Security assessment has been completed for PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support Pandas 3

1 participant