liveBook · Manning

Streamlit

As explained in The Well-Grounded Data Analyst

Streamlit is an open-source Python library for building interactive data applications with minimal application code.

Streamlit is a Python library for turning exploratory data analysis into interactive, web-based proof-of-concept applications with minimal application code. It suits stakeholder questions that need filters, charts, metrics, and underlying data in one accessible interface. section 10.2.4 section 11.2.2

A results-driven Streamlit workflow typically:

  • Loads and optionally caches data with st.cache_data so user actions do not reload unchanged datasets. section 11.2.2
  • Defines page elements in display order, including titles, explanations, charts, dropdowns, metrics, and tables. section 11.2.2
  • Connects dependent dropdowns to filtering logic, such as county, town, and street selections. section 11.2.1 section 11.2.2
  • Displays existing matplotlib and Plotly outputs alongside summary metrics and the raw records behind the analysis. section 11.2.2

House price explorer

A Wales house-price application loads property data, offers county, town, and street dropdowns, reports record counts and median sale prices, and renders transaction, property-type, and raw-data views. Run it with `streamlit run house_price_app.py` after activating the Poetry environment. section 11.2.2

if county_select:
    st.header(filter_message)

    metric_col1, metric_col2 = st.columns(2)
    metric_col1.metric("Number of records", f"{len(selected_data):,.0f}")
    metric_col2.metric("Median sale price", f"£{median_price:,.0f}")

    chart_col1, chart_col2, chart_col3 = st.columns(3)

    with chart_col1:
        st.subheader("Transactions over time")
        st.pyplot(helpers.transactions_per_year(selected_data))

    with chart_col2:
        st.subheader("Distribution of property type")
        st.pyplot(helpers.distribution_of_property_type(selected_data))

    with chart_col3:
        st.subheader("Median sale price by property type")
        st.pyplot(helpers.median_price_by_property_type(selected_data))

    st.header("Raw data")
    st.write(selected_data)

Inspect the finished layout combining filtered metrics, three charts, and the underlying data table. section 11.2.2

How The Well-Grounded Data Analyst covers it

How deep it goes
Explains targeted implementation through data loading, caching, layout, widgets, filtering, charts, metrics, and tables, without broader framework detail.
Examples
Uses a Wales house-price explorer with geographic dropdowns, ridgeplots, time series, property-type charts, metrics, and raw data.
What it assumes
Assumes Python data-analysis code and existing chart functions while teaching the required Streamlit elements from a focused app layout.
What you can do after
Build it from scratch as a focused proof of concept using existing analytical functions and a small set of Streamlit elements.
How it connects
Connects Streamlit with pandas, matplotlib, Plotly, ridgeplot, Shiny, Tableau, and Power BI.

Also explained in

Compare how 9 books explain Streamlit →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of The Well-Grounded Data Analyst. The section links point to the parts of the book it draws on.