Is there an option to do so as below ?
Current Value
25,482.50 (+0.23%)
Is there an option to do so as below ?
Current Value
25,482.50 (+0.23%)
Hey there, thanks for your question!
If you’re looking to display a metric like “Current Value 25,482.50 (+0.23%)” in Streamlit, the best way is to use st.metric, which supports both number formatting (including thousands separators and currency) and a delta value for the percentage change.
You can use the format parameter to control the number formatting, such as showing commas and decimal places, and the delta parameter for the percentage. For example:
import streamlit as st
st.metric(
label="Current Value",
value=25482.50,
delta=0.23,
format="accounting" # or "dollar", "localized", etc.
)
This will display the value with commas and two decimals, and the delta as a percentage. For more formatting options, see the st.metric documentation.
Sources:
I am looking for displaying the delta value and current value in the same line.