Skip to content

Instantly share code, notes, and snippets.

@nikkisharma536
Created June 11, 2020 09:33
Show Gist options
  • Save nikkisharma536/6c11559af2377be2346ec1c2d9060ebd to your computer and use it in GitHub Desktop.
Save nikkisharma536/6c11559af2377be2346ec1c2d9060ebd to your computer and use it in GitHub Desktop.
Multi select widget with streamlit
# Filters UI
subset_data = df
country_name_input = st.sidebar.multiselect(
'Country name',
df.groupby('Country/Region').count().reset_index()['Country/Region'].tolist())
# by country name
if len(country_name_input) > 0:
subset_data = df[df['Country/Region'].isin(country_name_input)]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment