Hi All,
I have used the below code to retrieve data based on the user selection.
container = st.beta_container()
all = st.sidebar.checkbox("Select all")
if all:
selected_options = container.multiselect("Select one or more years:",
# ['2016', '2017', '2018', '2019', '2020'], ['2016', '2017', '2018', '2019', '2020'])
else:
selected_options = container.multiselect("Select one or more years:",
['2016', '2017', '2018', '2019', '2020'])
show_data = df1[(df1['YEAR_NUMBER']).isin(selected_options)]
is_check = st.sidebar.button("Display Data")
if is_check:
st.write(show_data)
When the user manually select the ‘Year’ value and click on ‘Display Data’ button it shows the corrects information.
Whereas when he enables the “Select all” checkbox and click on ‘Display Data’ button it does not show any data.
Your inputs will be appreciated.
Thank You.