Data Visualization

Bank Marketing Dashboard

01 · Business Question File · Bank Dashboard · 1 of 10

Business Question

The entire dashboard is built around this question:

“Which customers are more likely to subscribe to the bank's term-deposit campaign, and what campaign/customer factors influence conversion?”

Every chart, filter and KPI in the dashboard helps answer this single business question.
02 · Project Pipeline File · Bank Dashboard · 2 of 10

End-to-End Pipeline

bank_market.csv → Pandas → Data Cleaning → Feature Engineering → Business KPIs → Plotly Charts → Dash Layout → Filters → Callbacks → Interactive Dashboard

This is the standard flow for any real-world data dashboard project.
03 · Load & Explore Data File · Bank Dashboard · 3 of 10

Load and Explore the Data

Python
import numpy as np
import pandas as pd
from dash import Dash, Input, Output, dcc, html, callback
import plotly.express as px
import plotly.graph_objects as go

df = pd.read_csv("bank_market.csv")

print(df.head())
print(df.shape)          # (45211, 18)
print(df.info())
print(df.isnull().sum())
The dataset has 45,211 customers and 18 columns. There are no missing values.
04 · Data Cleaning File · Bank Dashboard · 4 of 10

Data Cleaning

We clean column names and make all text values consistent (lowercase + strip spaces).

Python
# Remove spaces from column names
df.columns = df.columns.str.strip()

# Clean all text columns
for col in df.select_dtypes(include="object").columns:
    df[col] = df[col].astype(str).str.strip().str.lower()
Without this cleaning, values like "Manager", "manager", " MANAGER " would be treated as different categories.
05 · Target Variable File · Bank Dashboard · 5 of 10

Create the Target Variable

y is the business outcome:

  • y == "yes" → Customer subscribed
  • y == "no" → Customer did not subscribe
Python
df["subscribed"] = df["y"].map({"yes": 1, "no": 0})

print(df["subscribed"].value_counts())
# 0 → 39922
# 1 → 5289

conversion_rate = df["subscribed"].mean() * 100
print(conversion_rate)   # ≈ 11.70%
Subscription Split
39,922 No (88.3%) 5,289 Yes (11.7%)
06 · Feature Engineering File · Bank Dashboard · 6 of 10

Feature Engineering – Age Group

Python
df["age_group"] = pd.cut(
    df["age"],
    bins=[0, 30, 40, 50, 60, np.inf],
    labels=["under 30", "30-39", "40-49", "50-59", "60+"],
    right=False
)

print(df["age_group"].value_counts())
Creating age groups helps us analyze conversion patterns across different age segments.
07 · Dashboard Layout File · Bank Dashboard · 7 of 10

Dashboard Layout Structure

The layout contains:

  • Title
  • Filters (Job, Marital Status, Education, Subscription, Age Range)
  • Reset Button
  • KPI Cards (Total Customers, Avg Age, Avg Balance, Subscribers, Subscription Rate)
  • Six interactive charts
Filters and KPI cards are placed at the top so the user can quickly change the view and see the impact on numbers and charts.
08 · Main Callback File · Bank Dashboard · 8 of 10

Main Dashboard Callback

This single callback updates all KPIs and all charts whenever any filter changes.

Python
@callback(
    # KPI Outputs
    Output("Total_customers", "children"),
    Output("average_age", "children"),
    Output("average_balance", "children"),
    Output("Subscriber-count", "children"),
    Output("Subscription-rate", "children"),
    # Chart Outputs
    Output("age-chart", "figure"),
    Output("job-chart", "figure"),
    Output("subscription-chart", "figure"),
    Output("marital-chart", "figure"),
    Output("balance-chart", "figure"),
    Output("education-chart", "figure"),
    # Inputs (filters)
    Input("job-filter", "value"),
    Input("marital-filter", "value"),
    Input("education-filter", "value"),
    Input("subscription-filter", "value"),
    Input("age-filter", "value")
)
def update_dashboard(selected_job, selected_marital,
                      selected_education, selected_subscription,
                      selected_age):

    filtered_df = df.copy()

    # Apply filters
    if selected_job:
        filtered_df = filtered_df[filtered_df["job"] == selected_job]
    if selected_marital:
        filtered_df = filtered_df[filtered_df["marital"] == selected_marital]
    if selected_education:
        filtered_df = filtered_df[filtered_df["education"] == selected_education]
    if selected_subscription != "all":
        filtered_df = filtered_df[filtered_df["y"] == selected_subscription]

    min_age, max_age = selected_age
    filtered_df = filtered_df[filtered_df["age"].between(min_age, max_age)]

    # KPI calculations
    total_customers = len(filtered_df)
    average_age = round(filtered_df["age"].mean(), 1) if total_customers > 0 else 0
    average_balance = round(filtered_df["balance"].mean(), 2) if total_customers > 0 else 0
    subscriber_count = len(filtered_df[filtered_df["y"] == "yes"])
    subscription_rate = (subscriber_count / total_customers * 100) if total_customers > 0 else 0

    # Create charts (age histogram, job bar, subscription pie, etc.)
    # ...

    return (
        f"{total_customers:,}",
        f"{average_age}",
        f"${average_balance:,.0f}",
        f"{subscriber_count:,}",
        f"{subscription_rate:.1f}%",
        age_fig, job_fig, subscription_fig,
        marital_fig, balance_fig, education_fig
    )
One callback handles everything. When any filter changes, Dash calls this function, recalculates KPIs and regenerates all six charts.
09 · Reset Filters File · Bank Dashboard · 9 of 10

Reset Filters Callback

Python
@callback(
    Output("job-filter", "value"),
    Output("marital-filter", "value"),
    Output("education-filter", "value"),
    Output("subscription-filter", "value"),
    Output("age-filter", "value"),
    Input("reset-button", "n_clicks")
)
def reset_filters(n_clicks):
    return (None, None, None, "all", [minimum_age, maximum_age])
When the user clicks the Reset button, all filters return to their default values and the dashboard shows the full dataset again.
10 · Complete Code & Dashboard Output File · Bank Dashboard · 10 of 10

How to Run the Dashboard

Python
if __name__ == "__main__":
    app.run(debug=True, port=8051)
After running the code, open the link shown in the terminal (usually http://127.0.0.1:8051) to use the interactive dashboard.

Dashboard Output Preview

When the dashboard runs successfully you will see the following components:

Total Customers
45,211
Average Age
40.9
Average Balance
$1,362
Subscribers
5,289
Subscription Rate
11.7%
Age Distribution (Histogram)
Customer Age Count
Customers by Job (Bar Chart)
mgmt tech blue admin serv retir self other
Term Deposit Subscription (Pie / Donut)
11.7% Yes No 88.3% Yes 11.7%
Age vs Account Balance (Scatter)
Age Balance
Green = Subscribed (yes) · Blue = Not subscribed (no)
What you see in the real dashboard:
• 5 KPI cards at the top that update instantly when filters change
• Age histogram, Job bar chart, Subscription donut, Marital status bar, Age vs Balance scatter, Education vs Subscription grouped bar
• Interactive filters (Job, Marital, Education, Subscription, Age Range) + Reset button
• All charts and KPIs refresh together through a single callback
Corrections made from original notebook:
• Fixed typo maximu_age → maximum_age
• Ensured all component IDs are consistent
• Added missing callback import
• Cleaned column name handling
Home Bank Marketing Dashboard

Bank Marketing Dashboard

Complete end-to-end interactive dashboard built with Pandas + Plotly + Dash.

Select any topic from the left sidebar to begin.


Start Learning →