視覺化相關矩陣
直接閱讀 ansur_df 的相關矩陣(原始數值格式)不容易快速掌握重點。
讓我們先移除重複的值,並用 seaborn 將矩陣視覺化。
Seaborn 已以 sns 載入,matplotlib.pyplot 為 plt,NumPy 為 np,pandas 為 pd。
本練習屬於課程
Python 的降維
動手互動練習
試著完成這個範例程式碼,體驗一下這個練習。
# Create the correlation matrix
corr = ansur_df.____
# Draw a heatmap of the correlation matrix
sns.____(____, cmap=cmap, center=0, linewidths=1, annot=True, fmt=".2f")
plt.show()