Multiselect is not working fully.
After taking and saving three multi select results (one for each categorial column), I am removing all the unselected categories from the dataframe. Two of the columns are working and therefore removing some rows, but the other one is giving all unselected choices back again. The only difference with that column is that it has 10 unique values, which is more than the other ones.
I would be happy if someone could help me, I will upload code and screenshot if possible.
I have a dataframe called, with multiple columns. So I am applying multiselect for my three categorial columns, defaulting their unique values.
The values of the second one (department), even if I am removing from selection, is being added back to the selection box and therefore to dataframe as well.
Code is here:
select_experience = st.sidebar.multiselect('Students with Workexperience',
options=df['work_exp'].unique(),
default=df['work_exp'].unique())
select_department = st.sidebar.multiselect(label= 'Select the Department of the student',
options=df['department'].unique(), default=df['department'].unique())
select_gender = st.sidebar.multiselect(label = 'Select Students Gender',
options=df['gender'].unique(),
default=df['gender'].unique())
df_1 = df[(df['gender'].isin(select_gender))&(df['department'].isin(select_department))&(df['work_exp'].isin(select_experience))]
st.write(df_1)
It may sound strange but it is not giving any error, but selection is not working for that column only. Can someone help please?