How to format st.slider values to include commas

Hey there currently running my streamlit (v 1.30.0) app locally and deployed (both python 3.10) (however it is irrelevant for this post), For the st.slider component, how do you format the number to include a comma in the thousands spot?

shows there is a format option:
“A printf-style format string controlling how the interface should display numbers. This does not impact the return value. Formatter for int/float supports: %d %e %f %g %i Formatter for date/time/datetime uses Moment.js notation: Moment.js | Docs

The only one that changes anything is the %e which turns it to scientific formatting…

I looked into “sprintf” and came across “%'d” which does give an error of
" SyntaxError: [sprintf] unexpected placeholder"

What is the correct way to turn full numbers (1000) into (1,000) ?

I found that format “%.2f” will convert it to (1000.00) which matches python formatting but “%:,” doesn’t work like f"{1000:,}" would…

Please help. Thanks

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.