vendredi 22 octobre 2021

check the user input type using python and streamlit

I want to check the user input if its numeric or string.

The problem is that the if statement always take the user input as string even if the input is numeric its converted by default into a string.

How to fix this problem ?

all_columns = df.columns.tolist()
st_input_update = st.number_input if is_numeric_dtype(all_columns) else st.text_input
with col1_search:
    regular_search_term=st_input_update("Enter Search Term")

Aucun commentaire:

Enregistrer un commentaire