I have deployed a FPL Team maker application using Streamlit on Heroku. For this application, my initial plan was to use a multiselect element using which different player names could be selected. However, when I sorted the dataframe containing the player names alphabetically and used that as a list in
st.multiselect(), the options were not getting selected properly.
The error can be seen in the image. I printed out the dataframe and the ouput of the selection, and it can be seen that the dataframe is sorted on
first_name. I selected the first option, ‘Aaron Wan-Bissaka’ but the output (only the
second_name printed) was ‘Ozil’ as in ‘Mesut Ozil’ which is the first element in the unsorted dataframe.
It can also be seen that the list itself (showing only
second_name) in the select box is sorted based on
first_name and so is the dataframe but somehow during selection of the options, the order gets messed up.
I have since implemented a different method to select players but a solution to this would be definitely better!