Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Commas can't be removed from numbers in st.dataframe #8695

Closed
3 of 4 tasks
sfc-gh-tsimons opened this issue May 16, 2024 · 3 comments · Fixed by #8708
Closed
3 of 4 tasks

Commas can't be removed from numbers in st.dataframe #8695

sfc-gh-tsimons opened this issue May 16, 2024 · 3 comments · Fixed by #8708
Assignees

Comments

@sfc-gh-tsimons
Copy link

Checklist

  • I have searched the existing issues for similar issues.
  • I added a very descriptive title to this issue.
  • I have provided sufficient information below to help reproduce this issue.

Summary

Numbers are displayed in st.dataframe with commas and cannot be changed via ColumnConfig.

Reproducible Code Example

st.dataframe([1000000])

Steps To Reproduce

No response

Expected Behavior

We need to be able to change this via ColumnConfig. IMO, the default should be without and we should make it easy to add commas like this.

data_df, column_config={ format=",", ) }

Current Behavior

Numbers are automatically formatted as 1,000,000

Is this a regression?

  • Yes, this used to work in a previous version.

Debug info

  • Streamlit version: 1.31
  • Python version: 3.9
  • Operating System: OSX
  • Browser: Chrome

Additional Information

No response

@sfc-gh-tsimons sfc-gh-tsimons added status:needs-triage Has not been triaged by the Streamlit team type:bug Something isn't working labels May 16, 2024
Copy link

If this issue affects you, please react with a 👍 (thumbs up emoji) to the initial post.

Your feedback helps us prioritize which bugs to investigate and address first.

Visits

@LukasMasuch
Copy link
Collaborator

#8708 will change the number column to always use the raw value when copying or within the cell overlay. The thousand separator can also be removed from the cell rendering by using the number column formatting:

st.dataframe(
    {
        "value": [10000, 13123.41, 21312341.123, 4123],
    },
    column_config={"value": st.column_config.NumberColumn(format="%f")},
)

Its a reasonable consideration to don't use a thousand separator as default or to make this configurable within the format syntax. However, that will likely take a bit more effort since our formatting syntax (sprintf) doesn't support this natively :(

@LukasMasuch LukasMasuch added type:enhancement Requests for feature enhancements or new features and removed type:bug Something isn't working status:in-progress We're on it! labels May 27, 2024
@LukasMasuch LukasMasuch changed the title Commas can't be removed from numbers in st.dataframe Allow configuring thousand separator for st.dataframe via number column format paramter May 27, 2024
@LukasMasuch
Copy link
Collaborator

LukasMasuch commented May 27, 2024

Oh, I just saw that there is another feature request related to the thousand separator here: #7702 Therefore, I will close this issue with the linked PR and keep the other feature request open.

@LukasMasuch LukasMasuch changed the title Allow configuring thousand separator for st.dataframe via number column format paramter Commas can't be removed from numbers in st.dataframe May 27, 2024
@LukasMasuch LukasMasuch added type:bug Something isn't working and removed type:enhancement Requests for feature enhancements or new features labels May 27, 2024
@streamlit streamlit deleted a comment from github-actions bot May 27, 2024
@streamlit streamlit deleted a comment from github-actions bot May 27, 2024
LukasMasuch added a commit that referenced this issue May 27, 2024
## Describe your changes

This PR enforces that the raw number value is used in the cell overlay
and as copy value without any formatting applied. This was always
supposed to be the case, but wasn't fully enforced in the number column
yet.

[Demo](https://number-column-fix.streamlit.app/)

## GitHub Issue Link (if applicable)

- Closes #8695

## Testing Plan

- Added unit test and updated 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants