Hello, I am experiencing an issue in displaying a data frame using st.dataframe.
The issue is that the “values” are displayed with 3 zeros after comma even if i rounded the df :
Here is the code i used :
df_cli = df.groupby([“Client”], as_index=False).agg({
‘cost1’: ‘mean’,
‘cost2’:‘mean’,
‘cost3’:‘mean’,
}).round(2)
st.dataframe(df_cli , use_container_width=True)
i got this output display :
Can anyone help to display the values with only one or two decimals.
There are two pieces here: the stored value and how it’s displayed. Rounding is a computation to change the value. If you want to control how it’s displayed, you can use a dataframe styler. You can pass a styler element to Streamlit instead of the plain dataframe.