I2 · Working with Data: NumPy, pandas, SQL and Visualisation

Building a Data Dashboard

A data dashboard is a visual display of the key information needed to monitor a situation or make decisions, arranged on a single screen and usually updated automatically from data sources. It typically combines key performance indicators (KPIs) shown as large numbers with comparisons, trend charts, breakdowns by category and filters that let users focus on a time period, place or group. Dashboards can be built with business tools such as Power BI, Tableau and Looker Studio, or in Python with libraries such as Streamlit, Plotly Dash or Panel.

15 min Intermediate · Sublevel Beginner Jump to the activity

What you need: The earlier topics of this module.

Definition

A school principal wants to see attendance, test results and fee collection every morning without asking anyone to run reports. A dashboard puts the most important numbers and charts on one screen, updated automatically.

A data dashboard is a visual display of the key information needed to monitor a situation or make decisions, arranged on a single screen and usually updated automatically from data sources. It typically combines key performance indicators (KPIs) shown as large numbers with comparisons, trend charts, breakdowns by category and filters that let users focus on a time period, place or group. Dashboards can be built with business tools such as Power BI, Tableau and Looker Studio, or in Python with libraries such as Streamlit, Plotly Dash or Panel.

In simple words

A car's dashboard shows speed, fuel and warnings at a glance, so the driver can act without opening the bonnet. A data dashboard does the same for a school, a shop or a hospital.

Overview

  • A dashboard is a single screen of key numbers and charts that people check regularly to monitor something.
  • It is built around a few key performance indicators (KPIs) chosen with its users.
  • The most important numbers go at the top left, where people look first.
  • Each KPI should show a comparison: a target, last period or a trend.
  • Tools range from matplotlib grids and spreadsheets to Streamlit, Dash, Power BI and Tableau.
  • A dashboard must refresh reliably; stale numbers destroy trust.

Why it matters

Dashboards turn data into a daily habit for decision-makers, spot problems early and save hours of manual reporting. Designing one well requires understanding users, choosing the right measures and presenting them clearly.

Key terms

KPI
Key performance indicator: a number that shows progress towards a goal, such as attendance rate.
Filter
A control that limits the dashboard to a chosen period, place or group.
Drill-down
Clicking a summary to see the detail behind it.
Data refresh
Automatically reloading the latest data on a schedule.
Operational vs strategic
Daily monitoring dashboards versus long-term trend dashboards.
Streamlit
A Python library that turns a script into an interactive web dashboard.

Types

Dashboards are usually grouped into types by who uses them and how often. Each type has a different design.

1. Operational dashboards

Dashboards that track what is happening right now so that people can act quickly.

  • How it works: Data refreshes every few seconds or minutes; alerts and red-amber-green colours flag problems.
  • Example: A food-delivery control room showing live orders, late deliveries and riders available per zone.
  • When to use it: Use them for day-to-day monitoring by front-line teams.

2. Strategic (executive) dashboards

High-level dashboards showing long-term performance against goals.

  • How it works: A handful of KPIs updated weekly or monthly, each with a trend line and target.
  • Example: A state education department's dashboard of enrolment, attendance and learning outcomes by district.
  • When to use it: Use them for leaders who need the big picture, not every detail.

3. Analytical dashboards

Interactive dashboards for exploring data and finding causes.

  • How it works: Filters, drill-downs and linked charts let analysts slice the data by time, region and segment.
  • Example: A sales dashboard where clicking a state shows its cities and their best-selling products.
  • When to use it: Use them for analysts investigating why numbers changed.

4. Model-monitoring dashboards

Dashboards that track a deployed machine-learning model's health.

  • How it works: They show prediction volume, accuracy against later labels, input data drift and fairness metrics, with alerts when they cross thresholds.
  • Example: A fraud model's dashboard showing precision falling as fraudsters change tactics.
  • When to use it: Use them for every model in production, so problems are caught before users are harmed.

Explained in detail

Designing a dashboard

Start with users and decisions, not charts. Ask the principal what she decides each week, which numbers would change those decisions and how often she looks. Choose a handful of KPIs, usually five to seven, each with a comparison that gives it meaning: attendance today versus the 30-day average, fee collection versus the target, test pass rate versus last term. Arrange the screen so the most important information is at the top left, where eyes go first, with KPI cards across the top, trend charts below and detailed tables last. Use consistent colours, with red reserved for problems needing action, and add filters for class, section or month only if users need them.

Tools for building dashboards

ToolStrengthsGood for
Spreadsheet chartsFamiliar, quick, no codeSmall teams, simple data
Power BI, Tableau, Looker StudioDrag-and-drop, connects to databases, sharingOrganisations and business reporting
Streamlit (Python)Turns a Python script into a web app in minutes; can include ML modelsData scientists sharing analyses and model demos
Plotly Dash, PanelHighly customisable interactive Python appsComplex, production dashboards

In Streamlit, a dashboard can be as short as a few lines: st.metric("Attendance", "91%", "+2%") shows a KPI card with its change, st.line_chart(df) draws a trend and st.selectbox adds a filter; running streamlit run app.py opens it in a browser. Streamlit runs on your computer or a server rather than inside this site's in-browser Python, so the runnable example below builds a static dashboard with Matplotlib that shows the same layout ideas.

  • Show data freshness, such as "updated 7:00 a.m. today", so users trust the numbers.
  • Protect privacy: show aggregates, not individual students' details, unless users are authorised.
  • Review the dashboard with users after a few weeks and remove charts nobody uses.

A dashboard is only as reliable as the data behind it. Before sharing one, check that totals match the source system, that filters work correctly, that dates and time zones are handled consistently and that missing data is shown as missing rather than as zero. Document where each number comes from and how it is calculated, for example whether attendance counts half days. When users spot a number that looks wrong, investigate quickly and explain, because trust in a dashboard is easy to lose and slow to rebuild.

How it works

  1. Interview users about their decisions and how often they need information.
  2. Choose five to seven KPIs, each with a comparison or target.
  3. Sketch the layout: KPIs at the top, trends in the middle, details below.
  4. Build it with a suitable tool and connect it to data with automatic refresh.
  5. Test with users, protect privacy and keep improving.

In code

school_dashboard.py
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd

rng = np.random.default_rng(4)
days = pd.date_range("2025-07-01", periods=60, freq="B")                 # school days
attendance = np.clip(0.9 - 0.06 * (np.arange(60) > 40) + rng.normal(0, 0.015, 60), 0.7, 1)   # a dip after day 40
sections = pd.DataFrame({"section": ["6A", "6B", "7A", "7B", "8A", "8B"], "pass_rate": [0.88, 0.79, 0.91, 0.72, 0.85, 0.83]})
fees_collected, fees_target = 41.5, 48.0                                  # lakh rupees

today, avg30 = attendance[-1], attendance[-30:].mean()
kpis = [("Attendance today", f"{today:.0%}", f"{today - avg30:+.0%} vs 30-day avg", today >= avg30),
        ("Fees collected", f"Rs {fees_collected} L", f"{fees_collected / fees_target:.0%} of target", fees_collected >= fees_target),
        ("Lowest pass rate", sections.loc[sections.pass_rate.idxmin(), "section"], f"{sections.pass_rate.min():.0%}", sections.pass_rate.min() >= 0.8)]

fig = plt.figure(figsize=(12, 6))
for i, (name, value, note, ok) in enumerate(kpis):                      # KPI cards across the top
    ax = fig.add_axes([0.04 + i * 0.32, 0.72, 0.28, 0.22]); ax.axis("off")
    ax.text(0, 0.75, name, fontsize=11, color="grey")
    ax.text(0, 0.3, value, fontsize=22, weight="bold")
    ax.text(0, 0.0, note, fontsize=10, color="green" if ok else "crimson")   # red only when action is needed
trend = fig.add_axes([0.06, 0.1, 0.55, 0.5])
trend.plot(days, attendance * 100, color="#1f77b4")
trend.axhline(85, ls="--", color="grey"); trend.text(days[1], 85.5, "target 85%", color="grey")
trend.set_title("Attendance fell after mid-August"); trend.set_ylabel("Attendance (%)")
bars = fig.add_axes([0.68, 0.1, 0.28, 0.5])
order = sections.sort_values("pass_rate")
bars.barh(order.section, order.pass_rate * 100, color=["crimson" if v < 0.8 else "#9ab" for v in order.pass_rate])
bars.set_xlim(0, 100); bars.set_title("Pass rate by section (%)")

for name, value, note, ok in kpis:
    print(f"{name:<18} {value:<10} {note:<24} {'ok' if ok else 'needs attention'}")
print("Sections below 80%:", list(sections[sections.pass_rate < 0.8].section))

Output

Attendance today   84%        -2% vs 30-day avg        needs attention
Fees collected     Rs 41.5 L  86% of target            needs attention
Lowest pass rate   7B         72%                      needs attention
Sections below 80%: ['6B', '7B']

Try it yourself

Building a dashboard

Put the steps in order.

  1. 1Interview users about their decisions
  2. 2Sketch the layout
  3. 3Build and connect to data
  4. 4Test with users and refine
  5. 5Choose KPIs with comparisons

Useful KPI or vanity number?

For a school principal's daily dashboard.

  • Total number of rows in the database

  • Sections with pass rates below 80%

  • Attendance today versus the 30-day average

  • Number of colours used in the logo

  • Fee collection versus target

Common mistakes

  • Filling the screen with every available chart.
  • Showing numbers without comparisons or targets.
  • Displaying individual students' personal details without need or permission.

Check yourself

Question 1

1. What is a KPI?

Question 2

2. Where should the most important information go on a dashboard?

Question 3

3. Which Python library turns a script into a web dashboard quickly?

Summary

  • A dashboard shows key KPIs, trends and breakdowns on one screen, updated automatically.
  • Design from users' decisions: a few KPIs with comparisons, clear layout and purposeful colour.
  • Build with BI tools or Python libraries such as Streamlit, show data freshness and protect privacy.

Finished reading?

Sources: Streamlit documentation · Claus O. Wilke, Fundamentals of Data Visualization