Lesson 9 of 11 · 2 min
Step 7 — Correlation Analysis
import matplotlib.pyplot as plt # Correlation matrix corr = df.corr() print(corr) # Visualize with heatmap import seaborn as sns sns.heatmap(corr, annot=True, fmt='.2f', cmap='coolwarm') plt.show() # Find features most correlated with target corr['Survived'].sort_values(ascending=False) # Output: # Survived 1.000 # Fare 0.257 # Parch 0.082 # SibSp -0.035 # Age -0.077 # Pclass -0.338
