A complete EDA report on the Titanic dataset — summary stats, missing value heatmap, correlations, and survival breakdowns.
Use seaborn's built-in Titanic dataset so no download is needed.
import seaborn as sns
import pandas as pd
df = sns.load_dataset('titanic')
print(df.shape)
print(df.dtypes)
print(df.isnull().sum())
(891, 15) survived int64 pclass int64 sex object age float64 (177 missing) ...
A heatmap instantly shows which columns have gaps.
import matplotlib.pyplot as plt
plt.figure(figsize=(10, 4))
sns.heatmap(df.isnull(), cbar=False, cmap='viridis', yticklabels=False)
plt.title('Missing Value Heatmap')
plt.tight_layout()
plt.savefig('missing.png', dpi=150)
Break down survival rate by gender, class, and age.
# Survival by sex
print(df.groupby('sex')['survived'].mean().round(2))
# Survival by class
print(df.groupby('pclass')['survived'].mean().round(2))
# Age distribution by survival
fig, axes = plt.subplots(1, 2, figsize=(12, 4))
df[df.survived==1]['age'].dropna().hist(ax=axes[0], bins=30, color='#22c55e', alpha=0.7)
df[df.survived==0]['age'].dropna().hist(ax=axes[0], bins=30, color='#ef4444', alpha=0.7)
axes[0].set_title('Age Distribution: Survived (green) vs Not (red)')
# Correlation heatmap
corr = df.select_dtypes(include='number').corr()
sns.heatmap(corr, annot=True, fmt='.2f', cmap='coolwarm', ax=axes[1])
axes[1].set_title('Correlation Matrix')
plt.tight_layout()
plt.savefig('eda_charts.png', dpi=150)
print("Charts saved.")
sex female 0.74 male 0.19 pclass 1 0.63 2 0.47 3 0.24 Charts saved.
You now know the EDA playbook: shape → dtypes → missing values → distributions → correlations. Apply this to any new dataset before touching a model.
Spotted a bug, broken code, or something that doesn't look right? Tell us what's off and we'll fix it.