"Select All" not rending but individual selections work

In my sidebar, I have a multiselect widget to select states by membership. Selecting individual states works everywhere in my dashboard (some markdowns for KPI’s, a chloropleth, and some basic plots), but when I choose “Select All” nothing renders anywhere in the dashboard:

#state filter
state_list=dfNavi['State'].unique()
l2=[]
l2=state_list[:]
l2 = np.append('Select All', state_list)
state_dropdown = st.sidebar.multiselect('State:', l2)

if 'Select All' in state_dropdown:
    state_dropdown = state_list

dfNavi = dfNavi.query("State==@state_dropdown")

The dataframe is groupby on a flat file that just sums up a few fields that leads to State-Date as the key.

Individual that works:

“Select All” that doesn’t work:

Your code works as expected as far as I can tell. Anyway it seems unrelated to your issue since there is no attempt to render anything.

Figured it out. You were right, the lack of rendering was b/c I wasn’t telling the query to do anything.

if ‘Select All’ in state_dropdown:
dfNavi = dfNavi.query(“State!=@state_dropdown”)
else:
dfNavi = dfNavi.query(“State==@state_dropdown”)

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.