Build a Python Dashboard from a Jupyter Notebook

Add a filter, plot a chart, done. Mercury turns your notebook cells into a dashboard your team can open in a browser — no callbacks, no separate frontend.

4.3k GitHub starsOpen sourceApache-2.0
A Jupyter notebook beside a Mercury sales dashboard with region filters, key metrics, and an Altair chart

What is a Python dashboard?

A dashboard in Mercury is a notebook where changing an input — a dropdown, slider, checkbox, or number — recalculates the chart or table below it. Your team uses the controls in a browser while your pandas and plotting code stays in the notebook.

You are not maintaining a data pipeline and a separate user interface. A Mercury widget exposes a normal Python value, such as region.value, which you use in the cells below it. Mercury handles the clean browser layout and reactive execution.

Complete example

Build the whole dashboard in one notebook

The widget lives in its own cell. The filtering and chart stay below it, so Mercury knows exactly what to recompute after the selection changes.

sales-dashboard.ipynb
[1]
# Cell 1 — import packages and load data import pandas as pd import altair as alt import mercury as mr df = pd.read_csv("sales.csv")
[2]
# Cell 2 — add a dashboard filter region = mr.Select( label="Region", choices=["All", "North", "South", "East", "West"], value="All" )
[3]
# Cell 3 — filter data and display the chart filtered = df if region.value == "All" else df[df["region"] == region.value] chart = alt.Chart(filtered).mark_bar().encode( x="month", y="revenue" ) chart

Change “Region” in the browser, and the chart updates automatically. Mercury re-runs the cells below the changed widget.

Your data

Connect any data source

Your data can live in a file, database, API, or cloud service. Load it with normal Python, then use the resulting DataFrame in your dashboard.

Files

CSV, Excel, JSON, Parquet

Databases

PostgreSQL, MySQL, SQLite, Snowflake

APIs

REST APIs and JSON responses

Cloud storage

Amazon S3, Google Cloud, Azure

Interactive controls

Let people explore the dashboard

Add familiar controls so people can filter data, compare groups, and test different values without editing your Python code.

Sales dashboard controls

A practical example of five Mercury widgets

Browser preview
mr.Select
North

Show one region at a time.

mr.MultiSelect
North East

Compare several groups together.

mr.Slider
$0$25,000$50k

Filter with a clear numeric threshold.

mr.NumberInput
6

Enter an exact value for the calculation.

Display optionsmr.CheckBox
Include forecast

Turn an optional part of the dashboard on or off.

Change a control
Mercury runs the cells below
Charts and tables update

One simple rule

No callbacks or event handlers

Every widget works the same way: its value updates the cells below it. For installation, live preview, styling, authentication, and deployment, read the complete guide to turning a Jupyter notebook into a web app.

  • Keep the analysis and interface together
  • Use ordinary Python values
  • Share one browser link with your team
Mercury live preview showing a sales dashboard beside the Python notebook that powers it
One notebook, shown beside its live Mercury dashboard preview. Open the complete sales-dashboard tutorial.

FAQ

Common questions

Do I need a separate backend or API?+

No. The notebook contains both the analysis and the application logic. Mercury supplies the browser interface and runs the notebook for each interaction.

Can I use Plotly or Matplotlib instead of Altair?+

Yes. Mercury displays standard notebook outputs, so Altair, Matplotlib, and Plotly charts can all be used in a dashboard.

How is this different from a BI tool like Tableau or Power BI?+

Tableau and Power BI are primarily point-and-click tools. Mercury is code-first: data preparation, custom calculations, and any logic you can write in Python can remain part of the dashboard.

Does the dashboard update automatically when my database changes?+

A widget interaction re-runs the notebook cells below that widget. If the database query is in those cells, the data is loaded again. Mercury does not add background auto-refresh or real-time streaming by itself.

Can I password-protect a dashboard?+

Yes. Mercury supports a shared password, and user-based authentication is available as a paid add-on. Read about authentication.

Turn your notebook into a dashboard

Start with the notebook you already have. Add a Mercury control, preview the dashboard in your browser, and share it with your team.

pip install mercury