Hi, I am learning python and developing a data app in Streamlit.
I want to use the st.multiselect function with years (categorical data), respecting the order of my list years_series.
My current code allows users to see a pre-selected list of years. This works fine. But any further selections (by the user) are displayed after the pre-selection - which is not consistent.
I would like to have all the selected items be displayed in the order of my list (dates are ascending from 1998 to 2021). I don’t know if it is possible and how to do it?
Any suggestion would be useful.Thanks.
Code snippet:
> df = pd.read_csv('../data/dash/streamlit_v2.csv')
> year_series = df.drop_duplicates(subset=['Year'])['Year']
> year_tail = year_series.tail(11)
> year_selected = st.sidebar.multiselect('Choose years', year_series, year_tail)