Skip to content

Prepare pandas 3.0 compatibility#13630

Merged
lukasmasuch merged 4 commits intodevelopfrom
lukasmasuch/pandas-3-compat
Jan 20, 2026
Merged

Prepare pandas 3.0 compatibility#13630
lukasmasuch merged 4 commits intodevelopfrom
lukasmasuch/pandas-3-compat

Conversation

@lukasmasuch
Copy link
Copy Markdown
Collaborator

Describe your changes

Fixed deprecated pandas Styler API and clarified dtype handling for pandas 3.0 compatibility:

  • Replaced deprecated .applymap() with .map() in e2e test (breaking change in pandas 3.0)
  • Added clarifying comments to dtype checks that already handle StringDtype correctly

The codebase was already well-prepared for pandas 3.0. These changes ensure compatibility when pandas version constraint is updated from <3 to <4 in setup.py.

Testing Plan

  • No new tests required; changes are backwards compatible with pandas 2.x
  • Existing e2e and unit tests cover this functionality
  • Ready for testing with pandas 3.0 release candidate

Contribution License Agreement

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

…andling

- Replace deprecated .applymap() with .map() in e2e test for pandas 3.0 support
- Add clarifying comments about StringDtype handling in pandas 3.0+ to
  existing dtype checks that already handle the new string type correctly

The codebase was already well-prepared for pandas 3.0's StringDtype changes.
These changes ensure compatibility and document the behavior for maintainers.

Co-Authored-By: Claude <[email protected]>
Copilot AI review requested due to automatic review settings January 17, 2026 17:33
@snyk-io
Copy link
Copy Markdown
Contributor

snyk-io bot commented Jan 17, 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
Copy Markdown
Contributor

github-actions bot commented Jan 17, 2026

✅ PR preview is ready!

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

@lukasmasuch lukasmasuch added security-assessment-completed change:feature PR contains new feature or enhancement implementation impact:users PR changes affect end users labels Jan 17, 2026
Copy link
Copy Markdown
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 prepares the codebase for pandas 3.0 compatibility by replacing a deprecated Styler API and adding clarifying comments about dtype handling changes. The changes address the deprecation of .applymap() (removed in pandas 3.0) and document how StringDtype behavior differs between pandas 2.x and 3.0.

Changes:

  • Replaced .applymap() with .map() in an e2e test for pandas 3.0 compatibility
  • Added explanatory comments in three library files clarifying StringDtype and object dtype handling across pandas versions

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
e2e_playwright/st_dataframe_styler_support.py Replaced deprecated .applymap() with .map() for Styler element-wise operations
lib/streamlit/elements/lib/column_config_utils.py Added comment explaining pandas 3.0+ StringDtype handling and object dtype exclusion
lib/streamlit/elements/lib/built_in_chart_utils.py Added comment explaining dtype behavior after melting columns in pandas 3.0+
lib/streamlit/dataframe_util.py Added comment clarifying object dtype vs StringDtype handling in pandas 3.0+

lukasmasuch and others added 3 commits January 17, 2026 19:49
Replace style_negative function call with inline lambda to satisfy
pandas-stubs type expectations for Styler.map() callable signature.

Co-Authored-By: Claude <[email protected]>
Replace highlight_max function calls with inline lambdas to satisfy
pandas-stubs type expectations for Styler.apply() callable signature.
Also remove unused numpy.typing import.

Co-Authored-By: Claude <[email protected]>
The pandas-stubs types for Styler.map() and Styler.apply() are generic
and don't know the DataFrame contains only floats, causing false positive
type errors when comparing values with int/float literals.

Co-Authored-By: Claude <[email protected]>
@lukasmasuch lukasmasuch merged commit 4adc5bd into develop Jan 20, 2026
52 of 53 checks passed
@lukasmasuch lukasmasuch deleted the lukasmasuch/pandas-3-compat branch January 20, 2026 22:30
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants