Unexpected MixedNumericTypesError

st.number_input(
                "Percentage",
                min_value=Decimal("0.001"),
                max_value=Decimal("100.0"),
                value=Decimal("0.001"),
                step=Decimal("0.001")
            )

results in

StreamlitMixedNumericTypesError(value=value, min_value=min_value, max_value=max_value, step=step)
streamlit.errors.StreamlitMixedNumericTypesError: All numerical arguments must be of the same type.
value has Decimal type.
min_value has Decimal type.
max_value has Decimal type.
step has Decimal type.

Besides expecting this to work, the error doesn’t really make sense. Any ideas?

The error message is misleading, but you are not supposed to pass Decimal values to st.number_input.

And why is that?

Well, because the docs say so, hence the link in my answer. Or if you mean why the API was designed that way, I couldn’t tell. I guess they thought int and floatwere enough.

I see, thank you!

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