About number_input for very small number

Hi team, I need to input some very small number like: 0.0000045, but when I’m trying to use st.number_input, it seems it doesn’t support this, it could only show number like 0.00.
temp = st.number_input(label=‘test’,min_value=0.000000,step=0.000001,max_value=0.0005,value=0.0000045)
截屏2021-11-12 下午2.30.19

Is there any way to resolve this?

Hi @Sunix_Liu -

Adding the format parameter worked for me:

import streamlit as st

temp = st.number_input(
    label="test",
    min_value=0.000000,
    step=0.000001,
    max_value=0.0005,
    value=0.0000045,
    format="%f",
)

Best,
Randy

2 Likes

@randyzwitch Thank you man! How I missed that…it works perfect for me now.

1 Like

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