I wanted to use streamlit selectbox so users can select from a column in the pandas data frame. I have executed the code properly but it takes too long for streamlit to load the option because the total number of entries in the list is huge. Is there any solution to reduce the time or to have a search box kind of feature so that all the options are not loaded into the dropdown box ? Thanks in advance.
Steps to reproduce
Code snippet:
song_list = df['name'].unique()
user_name = st.selectbox('Choose your favourite song here',song_list)
Expected behavior:
It takes too long for the code to process and the drop down menu to appear.
Actual behavior:
I would like to reduce the time it takes for the drop down menu to appear or the drop down menu does not appear and we just get a search bar and it takes less time.
Iβm not sure how to solve your problem using a selectbox, but instead you could use streamlit aggrid to display the options and return the song the user clicks on
Depending on your use case, you could consider doing a textbox and just using whatever the user types to filter down the list that is then displayed (probably checking to see if theyβve entered at least 2-3 characters before doing anything). If you wanted to do this βliveβ, you could use the streamlit-keyup component for this GitHub - blackary/streamlit-keyup: Streamlit text input that returns value on keyup