First use selectbox then multiselect data

I have a data frame and I need to select data from one column using selectbox() and then multi-select data from the dropdown list by using multiselect(), anybody knows how to set default value since multiselect() needs to set a default value.

|columnA|columnB|columnC|
|1|AA|ghg|
|2|BB|abd|
|3|AA|abf|
|4|CC|bbb|
|5|AA|ddd|
|6|BB|rrr|
|7|AA|eee|
|8|CC|ddd|
|9|AA|fff|
|10|BB|abf|
|11|AA|abd|
|12|CC|ghg|

First selectbox(columnB), then multiselect(columnC)

Thanks.

Hi @vivian,

First welcome back* to the Streamlit community! :tada: :partying_face: :star:

When creating a question we recommend you follow these guidelines to help you create a question that is more likely to get an answer:

So the st.multiselect does not need to have a default value, but st.selectbox does. Check out our docs on each of these to know how to pass all of the possible parameters to the widgets:

Selectbox docs

Multiselect docs

Here is a code example:

import streamlit as st

select = st.selectbox("A selectbox", ["A", 'B', "C"], 0)

multi = st.multiselect("A multiselect", ["A", 'B', "C"])

Happy Streamlit-ing!
Marisa

2 Likes

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