In [15]:
#y correlation matrix
k = 10 #number of variables for heatmap
corrmat = train_df.corr()
cols = corrmat.nlargest(k, 'y')['y'].index
cm = np.corrcoef(train_df[cols].values.T)
sns.set(font_scale=1.25)
hm = sns.heatmap(cm, cbar=True, annot=True, square=True, fmt='.2f',
                 annot_kws={'size': 10}, yticklabels=cols.values, xticklabels=cols.values)
plt.show()
In [ ]: