开始使用免费开始使用

可视化相关性矩阵

直接阅读 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()
编辑并运行代码