streamlit - Warning: NumberInput value below has type int so is displayed as int despite format string %.1f. code example

Example: streamlit - Warning: NumberInput value below has type int so is displayed as int despite format string %.1f.

import streamlit as st
st.number_input(label="float displayed as integer", format="%i", value=2.4)

# The solution for the waring here is to use format="%i" instead of format="%0f"

# Moreover, here below some options we can use with st.number_input()
prior_variance = st.sidebar.number_input(
label=“Prior Variance”,
min_value=0.00,
value=0.027,
step=0.01,
format="%i",,
)

Tags:

Misc Example