Python for Consultants — Week 3: Visualization & Dashboards
Python for Consultants
Week 3 Learning Guide
Visualization & Dashboards: From Data to Decision
What You Will Learn This Week
Week 3 is where Python becomes a visual storytelling tool. You will learn to create static charts (Matplotlib), styled
statistical charts (Seaborn), interactive browser-based charts (Plotly), and full web dashboards that non-technical
clients can use — all with Streamlit. By Day 24 you will have a production-quality dashboard.
Install: pip install matplotlib seaborn plotly streamlit openpyxl
Key Rule for This Week
Streamlit files (Days 21-24) must be run differently from normal Python files. In your terminal run: streamlit run
[Link] — this opens a browser tab automatically. Do NOT run them with 'python [Link]'.
Week 3 at a Glance
DAY Matplotlib Basics
17 Topics: Bar, horizontal bar, line, scatter, pie, subplots, savefig()
Key syntax: [Link]() | [Link]() | [Link]() | [Link]()
Exercise: Build a 2×2 subplot dashboard with revenue, NPS, growth, sector pie
DAY Seaborn
18 Topics: [Link], heatmap, boxplot, scatterplot, lineplot, set_theme()
Key syntax: sns.set_theme(style='whitegrid') | [Link](corr,
annot=True)
Exercise: Create a correlation heatmap and NPS distribution by sector
DAY Plotly Express
19 Topics: [Link], [Link], [Link], [Link] — interactive charts in browser
Key syntax: [Link](df,x='rev',y='nps',color='sector',size='growth')
Exercise: Build 5 interactive charts and open them in your browser
DAY Plotly Advanced
20 Topics: [Link](), make_subplots(), dual axis, waterfall, annotations
Key syntax: make_subplots(rows=2,cols=2) | [Link]() | [Link]()
Exercise: Build a 4-panel executive dashboard and a P&L waterfall chart
DAY Intro to Streamlit
Page 1 of 4
Python for Consultants — Week 3: Visualization & Dashboards
Topics: [Link], [Link], [Link], st.plotly_chart, sidebar, cache
21 Key syntax: st.set_page_config() | @st.cache_data | [Link](4)
Exercise: Run your first Streamlit app showing KPIs, charts, and a data table
DAY Streamlit Widgets
22 Topics: [Link], [Link], [Link], [Link] — live filtering
Key syntax: sectors = [Link]('Sector', options=[...],
default=[...])
Exercise: Add sidebar filters that dynamically update all charts and metrics
DAY Streamlit Layout
23 Topics: [Link], [Link], [Link], st.download_button, custom CSS
Key syntax: tab1,tab2 = [Link](['Overview','Risk']) |
st.download_button()
Exercise: Build a multi-tab executive brief with a download button
DAY Mini Project
24 Topics: Brand Performance Dashboard — full interactive Streamlit app
Key syntax: Full app: filters + KPIs + funnel + scatter matrix + radar +
export
Exercise: Run the dashboard, explore all tabs, share it with a colleague
Quick Reference Cheat Sheet
Matplotlib — Key Patterns
fig, ax = [Link](figsize=(10, 5))
[Link](x, y, color='#2E75B6')
[Link](x, y, marker='o', linewidth=2)
ax.set_title('Title', fontsize=13, fontweight='bold')
ax.set_xlabel('X') | ax.set_ylabel('Y')
plt.tight_layout()
[Link]('[Link]', dpi=150)
# Subplots
fig, axes = [Link](2, 2, figsize=(12, 8))
axes[0,0].bar(x, y)
Plotly Express — Key Patterns
fig = [Link](df, x='client', y='revenue', color='sector',
title='Revenue by Client', text='revenue')
fig.update_traces(texttemplate='%{text:.0f}B', textposition='outside')
fig.update_layout(plot_bgcolor='white', xaxis_tickangle=-30)
Page 2 of 4
Python for Consultants — Week 3: Visualization & Dashboards
fig.write_html('[Link]') # save as interactive HTML
# Scatter with bubbles
[Link](df, x='revenue', y='nps', color='sector',
size='growth', text='client', size_max=40)
Plotly Subplots
from [Link] import make_subplots
import plotly.graph_objects as go
fig = make_subplots(rows=2, cols=2,
subplot_titles=('Rev','NPS','Growth','Margin'))
fig.add_trace([Link](x=df['client'], y=df['revenue']), row=1, col=1)
fig.add_trace([Link](x=df['client'], y=df['nps']), row=1, col=2)
fig.update_layout(title='Dashboard', height=700)
Streamlit — Key Patterns
st.set_page_config(page_title='App', layout='wide')
@st.cache_data
def load_data(): return [Link](...)
# Layout
col1, col2, col3 = [Link](3)
[Link]('Revenue', '$94B', delta='+8%')
# Widgets
selected = [Link]('Sector', options, default=options)
df_filtered = df[df['sector'].isin(selected)]
# Tabs
tab1, tab2 = [Link](['Overview', 'Detail'])
with tab1:
st.plotly_chart(fig, use_container_width=True)
# Download
st.download_button('Download CSV', df.to_csv(), '[Link]')
Chart Selection Guide
• Bar chart: comparing values across categories (revenue by client, NPS by sector)
• Line chart: trends over time (quarterly revenue, NPS over months)
• Scatter plot: relationship between two metrics (revenue vs NPS, growth vs margin)
Page 3 of 4
Python for Consultants — Week 3: Visualization & Dashboards
• Bubble chart: scatter with a third dimension (add 'size=' for revenue/importance)
• Pie/Donut: composition (share of revenue by sector — use sparingly, max 5 segments)
• Heatmap: correlation matrix or performance grid across two dimensions
• Box plot: distribution and outliers by category
• Waterfall: P&L, budget variance, or value bridge analysis
• Funnel: brand/sales funnel (awareness → consideration → purchase → loyalty)
Coming in Week 4: Consultant Applications
Week 4 connects Python to the real consulting toolkit: Excel automation, automated reporting, external APIs, and
web scraping. You will build tools that actually save you hours of manual work every week.
Page 4 of 4