Skip to content

replace removed Styler.applymap with Styler.map#154

Merged
PradeepJaiswar merged 1 commit into
masterfrom
fix/pandas-version-issue-streamlit
Jul 4, 2026
Merged

replace removed Styler.applymap with Styler.map#154
PradeepJaiswar merged 1 commit into
masterfrom
fix/pandas-version-issue-streamlit

Conversation

@PradeepJaiswar

Copy link
Copy Markdown
Contributor

Fix: Styler.applymap removed in pandas 3.0

Problem

Opening the Portfolio & Streaming → Sector Index Comparison example in the interactive Streamlit app crashes with:

AttributeError: 'Styler' object has no attribute 'applymap'
  File "interactive_examples/streamlit_app.py", line 1503, in <module>
    st.dataframe(df.style.applymap(color_chg, subset=["Change", "Change %"]), ...)

pandas.io.formats.style.Styler.applymap was deprecated in pandas 2.1.0 and removed in pandas 3.0. Since
interactive_examples/requirements.txt pins no upper bound on pandas, users on a current pandas pick up 3.x and hit the
crash.

Fix

Rename the two elementwise-styling calls from .style.applymap(...) to .style.map(...). Styler.map is the direct
replacement with an identical signature (func, subset=), so this is a pure rename with no behavior change.

Affected lines in interactive_examples/streamlit_app.py:

  • Line 1503 — Sector Index Comparison (color Change / Change % cells)
  • Line 1802 — status coloring example

@KetanGupta12 KetanGupta12 self-requested a review July 4, 2026 05:12
@PradeepJaiswar PradeepJaiswar merged commit 1961d46 into master Jul 4, 2026
4 checks passed
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.

4 participants