Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@alexmalins
Copy link
Contributor

@alexmalins alexmalins commented Jun 11, 2025

Describe your changes

Adds format="yen" option for NumberColumn & ProgressColumn for displaying Japanese Yen (¥).

This is an equivalent option to the existing "dollar" and "euro" options.

The motivation for this is it appears difficult with the printf-style formatting to format yen amounts with a ¥ char first, commas as thousandths separators, and minus in front of ¥ if the amount is negative.

Minimal code example:

import pandas as pd
import streamlit as st

st.dataframe(
    pd.DataFrame({"yen": [-1234]}),
    column_config={"yen": st.column_config.NumberColumn(format="yen")},
)
image

GitHub Issue Link (if applicable)

Testing Plan

Added new NumberColumn, ProgressColumn and dataframe utils JS tests.


Contribution License Agreement

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

@snyk-io
Copy link
Contributor

snyk-io bot commented Jun 11, 2025

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

security/snyk check is complete. No issues have been found. (View Details)

license/snyk check is complete. No issues have been found. (View Details)

@sfc-gh-bnisco sfc-gh-bnisco self-assigned this Jun 11, 2025
@sfc-gh-bnisco sfc-gh-bnisco added change:feature PR contains new feature or enhancement implementation impact:users PR changes affect end users labels Jun 11, 2025
@sfc-gh-bnisco sfc-gh-bnisco requested a review from Copilot June 11, 2025 17:22
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 adds a new "yen" formatting option to both NumberColumn and ProgressColumn, enabling display of Japanese yen amounts consistently across the app.

  • Added "yen" formatting option in the column types and updated related docstrings.
  • Updated the UI formatting menu and added unit/e2e tests for the new option.
  • Extended the utilities to support yen formatting via Intl.NumberFormat with zero fraction digits.

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.

Show a summary per file
File Description
lib/streamlit/elements/lib/column_types.py Updated option lists and docstrings for NumberColumn and ProgressColumn to include "yen".
frontend/lib/src/components/widgets/DataFrame/menus/FormattingMenu.tsx Added "yen" entry to the formatting menu.
frontend/lib/src/components/widgets/DataFrame/menus/FormattingMenu.test.tsx Added test assertion to check for the display of "Yen".
frontend/lib/src/components/widgets/DataFrame/columns/utils.ts Added "yen" branch in the number formatting utility using currency JPY.
frontend/lib/src/components/widgets/DataFrame/columns/utils.test.ts Introduced tests to verify the yen formatting outputs.
frontend/lib/src/components/widgets/DataFrame/columns/ProgressColumn.test.ts Added test case to validate yen formatting for ProgressColumn.
frontend/lib/src/components/widgets/DataFrame/columns/NumberColumn.test.ts Added test case to validate yen formatting for NumberColumn.
e2e_playwright/st_dataframe_config.py Extended configuration to include a test for the "yen" format.

Copy link
Collaborator

@sfc-gh-bnisco sfc-gh-bnisco left a comment

Choose a reason for hiding this comment

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

Hello @alexmalins , thank you for your contribution! This seems like a handy addition to our library. This PR is failing due to updates in the snapshots. Can you please update the snapshots and add them to this branch in order for tests to pass? Directions on how to do so can be found in our contribution docs: https://github.com/streamlit/streamlit/wiki/Running-e2e-tests-and-updating-snapshots#updating-screenshots Thanks!

@alexmalins alexmalins force-pushed the add-yen-currency-format branch from f1756fe to 12998c2 Compare June 12, 2025 12:33
@alexmalins
Copy link
Contributor Author

alexmalins commented Jun 12, 2025

done thanks @sfc-gh-bnisco 🙌

Edit: still seeing some test failures: https://github.com/streamlit/streamlit/actions/runs/15610623649
Are some of these real caused by this PR or are they all flakes? They look to be all on components not touched by this PR... 🤔

@alexmalins alexmalins force-pushed the add-yen-currency-format branch from 12998c2 to 2306a3e Compare June 12, 2025 14:28
@sfc-gh-bnisco
Copy link
Collaborator

@alexmalins Thank you for the updates! I merged latest develop into this branch and re-ran CI and tests passed on this run. Those must have been unrelated flakes prior.

@sfc-gh-bnisco sfc-gh-bnisco added the security-assessment-completed Security assessment has been completed for PR label Jun 12, 2025
@sfc-gh-bnisco sfc-gh-bnisco merged commit 02fe4b7 into streamlit:develop Jun 12, 2025
35 of 36 checks passed
@alexmalins alexmalins deleted the add-yen-currency-format branch June 16, 2025 01:06
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.

2 participants