AI Hints
Home›Data Science Tutorial›Storytelling and Tools
Data Science · Lesson 28 of 101

Dashboards

From one report to a living tool.

⏱ 2 min read▶ Video at 48:16🎓 Free
Watch this lesson in the Data Science courseWatch on YouTube ↗Full Data Science course

Every Monday, each cafe manager emails you for last week's numbers. You could spend your whole week answering them. Or you could build one small tool, and never have to answer that question again.

Dashboards
From the video: Dashboards
  • Monday emails
  • Answering the same questions
  • Build a tool once

A dashboard in fifteen lines

Streamlit turns a Python script into a web app. A title, a drop down for the cafe, two big numbers, and a chart. Each time someone picks a cafe, the script runs again. There's no web development at all. Save this, and run streamlit run. Now every manager has live numbers, whenever they want them.

dashboard.pypython
import pandas as pd
import streamlit as st

sales = pd.read_csv("sales.csv", parse_dates=["date"])

st.title("Harbor Coffee")
city = st.selectbox("Cafe", sorted(sales["city"].unique()))
view = sales[sales["city"] == city]

left, right = st.columns(2)
left.metric("Revenue", f"${view['revenue'].sum():,.0f}")
right.metric("Profit", f"${view['profit'].sum():,.0f}")
st.line_chart(view.groupby("date")["revenue"].sum())

What a manager sees

In the browser, the manager picks a cafe. Two big numbers update, for revenue and profit. And a line chart shows the trend. It's simple, and that's the point. Good dashboards answer a few questions very well. If a dashboard has twenty charts, it answers none of them.

Dashboards that get used

Build for a person, and for a decision. Put the most important number at the top. Show comparisons, not just totals, such as against last week or a target. Keep it fast. Check who's actually using it. And retire charts that nobody looks at. Tools such as Tableau, Power BI, and Metabase are the usual choices in big companies.

One audienceone decision
Compareto last week or a target
Keep it fastslow tools die
Retire what's unusedless is more

Summary

One small tool saves hours each week. Next, models. As a data scientist, you'll sometimes need to predict. Let's do that the practical way.

Key takeaways
  • Streamlit turns scripts into apps
  • Answer a few questions well
  • Show comparisons
Next up: Prediction for Data Scientists — a quick practical model