An interactive data exploration dashboard — upload any CSV, instantly get summary stats, correlation heatmaps, histograms, and scatter plots, all in a shareable web app.
Streamlit turns Python scripts into web apps. The file_uploader widget lets users drop in any CSV.
# app.py
import streamlit as st
import pandas as pd
import plotly.express as px
import plotly.graph_objects as go
st.set_page_config(page_title='EDA Dashboard', layout='wide')
st.title('📊 EDA Dashboard')
st.caption('Upload any CSV file to explore your data with interactive charts.')
uploaded_file = st.file_uploader('Upload a CSV file', type=['csv'])
if uploaded_file:
df = pd.read_csv(uploaded_file)
st.success(f'Loaded {len(df):,} rows × {len(df.columns)} columns')
else:
# Use a sample dataset if no file uploaded
from sklearn.datasets import load_iris
iris = load_iris(as_frame=True)
df = iris.frame
df['species'] = df['target'].map({0: 'setosa', 1: 'versicolor', 2: 'virginica'})
st.info('No file uploaded — showing Iris dataset as demo. Upload your own CSV above.')
Display the first few rows, shape, data types, and descriptive statistics.
# Add this after loading df
# Dataset overview
col1, col2, col3 = st.columns(3)
col1.metric('Rows', f'{len(df):,}')
col2.metric('Columns', len(df.columns))
col3.metric('Missing', f'{df.isnull().sum().sum():,}')
st.subheader('Preview')
st.dataframe(df.head(10), use_container_width=True)
st.subheader('Summary Statistics')
st.dataframe(df.describe(), use_container_width=True)
st.subheader('Data Types')
dtype_df = pd.DataFrame({
'Column': df.dtypes.index,
'Type': df.dtypes.values.astype(str),
'Missing': df.isnull().sum().values
})
st.dataframe(dtype_df, use_container_width=True)
Let users choose which column to plot and how many bins to use.
st.subheader('Distribution — Histogram')
numeric_cols = df.select_dtypes(include='number').columns.tolist()
cat_cols = df.select_dtypes(include='object').columns.tolist()
col_a, col_b = st.columns([2, 1])
with col_a:
hist_col = st.selectbox('Select column', numeric_cols, key='hist_col')
with col_b:
bins = st.slider('Number of bins', 10, 100, 30)
color_by = st.selectbox('Colour by (optional)', ['None'] + cat_cols, key='hist_color')
color_col = None if color_by == 'None' else color_by
fig_hist = px.histogram(
df, x=hist_col, nbins=bins, color=color_col,
title=f'Distribution of {hist_col}',
template='plotly_white'
)
st.plotly_chart(fig_hist, use_container_width=True)
Show how numeric columns relate to each other at a glance.
st.subheader('Correlation Heatmap')
if len(numeric_cols) >= 2:
corr = df[numeric_cols].corr()
fig_heat = go.Figure(data=go.Heatmap(
z=corr.values,
x=corr.columns.tolist(),
y=corr.index.tolist(),
colorscale='RdBu_r',
zmid=0,
text=corr.round(2).values,
texttemplate='%{text}',
textfont={'size': 11}
))
fig_heat.update_layout(
title='Pearson Correlation Matrix',
template='plotly_white',
height=500
)
st.plotly_chart(fig_heat, use_container_width=True)
else:
st.info('Need at least 2 numeric columns for a correlation heatmap.')
Let users explore relationships between two variables interactively.
st.subheader('Scatter Plot')
if len(numeric_cols) >= 2:
col1, col2, col3 = st.columns(3)
with col1:
x_col = st.selectbox('X axis', numeric_cols, key='scatter_x')
with col2:
y_col = st.selectbox('Y axis', numeric_cols, index=1 if len(numeric_cols) > 1 else 0, key='scatter_y')
with col3:
color_col = st.selectbox('Colour by', ['None'] + cat_cols + numeric_cols, key='scatter_color')
color_arg = None if color_col == 'None' else color_col
fig_scatter = px.scatter(
df, x=x_col, y=y_col, color=color_arg,
title=f'{x_col} vs {y_col}',
template='plotly_white',
opacity=0.7,
trendline='ols' if color_arg is None else None
)
st.plotly_chart(fig_scatter, use_container_width=True)
[Browser shows interactive Streamlit dashboard with:] - 3 metric cards: Rows: 150 | Columns: 6 | Missing: 0 - Preview table with first 10 rows - Summary statistics table - Dropdown to pick histogram column + slider for bins - Colour heatmap showing correlations between all numeric columns - Scatter plot with X/Y/colour axis selectors
Your EDA dashboard works on any CSV — sales data, survey results, sports stats, financial data. Streamlit + Plotly is the fastest way to turn a pandas DataFrame into an interactive web app that non-technical stakeholders can use.
Spotted a bug, broken code, or something that doesn't look right? Tell us what's off and we'll fix it.