Use heatmap to display a list of correlation coefficients using kaggle Titanic Victim Data Note that you can only check by numerical value
corr.py
# lib install
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
%matplotlib inline
train = pd.read_csv('./train.csv')
train.head()
corr.py
plt.figure(figsize=(8, 6)) #heatmap size
sns.heatmap(train.corr(), annot=True, cmap='plasma', linewidths=.5) # annot:Whether to display the value linewidths:Cut line
In this example, it's important to survive, so if you look at the Survived column, you'll find the variables that correlate.
Reference: Seaborn Heatmap
Recommended Posts