A drop-down menu is a Streamlit input widget for choosing one option from a list. In an interactive proof of concept, the selection filters data and updates the displayed analysis. section 11.2.2
Use drop-down menus to:
- Offer fixed choices, such as counties loaded from property data. section 11.2.2
- Create dependent choices, where available towns depend on the selected county and streets depend on both county and town. section 11.2.1 section 11.2.2
- Represent an unselected state with placeholders such as “-- No town selected --”. section 11.2.2
- Apply the selected values to a pandas query before calculating metrics, charts, and raw results. section 11.2.2
House price explorer
Three Streamlit selectboxes let users choose a Welsh county, town, and street. The app then reports record counts and median sale prices, displays charts, and shows the filtered raw data. section 11.2.2
st.header("Explore house prices at different levels")
select_col1, select_col2, select_col3 = st.columns(3)
with select_col1:
county_select = st.selectbox(
'Select a county:',
helpers.get_counties(wales),
index=None,
placeholder="-- Select a county --"
)
TOWN_NULL_VALUE = "-- No town selected --" #1
with select_col2:
town_select = st.selectbox(
'Select a town:',
helpers.get_towns(
wales,
county_select, #2
null_value=TOWN_NULL_VALUE),
index=None,
placeholder=TOWN_NULL_VALUE
)
STREET_NULL_VALUE = "-- No street selected --"
with select_col3:
street_select = st.selectbox(
'Select a street:',
helpers.get_streets(
wales,
county_select,
town_select,
null_value=STREET_NULL_VALUE),
index=None,
placeholder=STREET_NULL_VALUE
)
Inspect the selectbox implementation for geographic filtering, including columns, placeholders, and helper functions that populate dependent options. section 11.2.2









