Cannot keep float number from st.data_editor

When I input float number like “0.2” or “1.23” to st.data_editor using st.column_config.NumberColumn
it always return a round number in integer like “0” or “1”
please help me

edited_df = st.data_editor(df, num_rows=“dynamic”,use_container_width = True,
column_config = {“回転数” : st.column_config.NumberColumn(width = “small”, min_value = 0, max_value = 1000),
“DRYレート” : st.column_config.NumberColumn(width = “small”,min_value = 0, max_value = 1000),
“凝固剤濃度” : st.column_config.NumberColumn(min_value = 0, max_value = 1000, step = 0.1),
“凝固剤_phr” : st.column_config.NumberColumn(min_value = 0.01, max_value = 99.99, step = 0.01),
“注水1流量” : st.column_config.NumberColumn(min_value = 0, max_value = 1000),
“注水2流量” : st.column_config.NumberColumn(min_value = 0, max_value = 1000),
“注水2濃度” : st.column_config.NumberColumn(min_value = 0, max_value = 1000, step = 0.01),
“注水2_phr” : st.column_config.NumberColumn(min_value = 0.01, max_value = 99.99, step = 0.01)
}
)
st.write(edited_df)

Hi @Cong_Tran_Chi
Did you try to change min_value and max_value to a float? Like max_value = 1000.0?
Your value there is an integer.
Sorry, did not test if this is the solution, just a guess.

Good luck,
Liv

The output edited_df has the same columns with the same types as the input df.

1 Like

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