Prepare pandas 3.0 compatibility#13630
Merged
lukasmasuch merged 4 commits intodevelopfrom Jan 20, 2026
Merged
Conversation
…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]>
Contributor
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
Contributor
✅ PR preview is ready!
|
Contributor
There was a problem hiding this comment.
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+ |
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]>
sfc-gh-bnisco
approved these changes
Jan 20, 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.
Describe your changes
Fixed deprecated pandas Styler API and clarified dtype handling for pandas 3.0 compatibility:
.applymap()with.map()in e2e test (breaking change in pandas 3.0)The codebase was already well-prepared for pandas 3.0. These changes ensure compatibility when pandas version constraint is updated from
<3to<4in setup.py.Testing Plan
Contribution License Agreement
By submitting this pull request you agree that all contributions to this project are made under the Apache 2.0 license.