I have a dataframe that includes a column "birthdate" but its of type object like this 1984-11-15
format y%-%M-%d.
I want to convert it to date and just extract the year with no duplication in order to filter the dataframe based on the year.
I am using the multiselect option in order to allow the user to filter the dataframe choosing multiple options, but when i try to convert the column type the system crash and display the below error.
StreamlitAPIException : Every Multiselect default value must exist in options
Traceback:
File "f:\AIenv\streamlit\TEC_APPS\fit_in_out_leb.py", line 762, in <module>
main()File "f:\AIenv\streamlit\TEC_APPS\fit_in_out_leb.py", line 366, in main
db_stb = st.sidebar.multiselect("Select date of birth ",list(query_bd),default = query_bd)
what this error mean and how to fix it ?
code:
df['birthdate'] = pd.to_datetime(df['birthdate'])
query_bd = df.birthdate.unique()
db_stb = st.sidebar.multiselect("Select date of birth ",list(query_bd),default = query_bd)