相关矩阵并没有显示python的所有列

2024-06-01 03:15:47 发布

您现在位置:Python中文网/ 问答频道 /正文

我试图解决来自Kaggle的“房价”挑战,但我被困在关联矩阵上,因为它根本不能显示我想要的所有列。最初,很明显是因为列数太多,所以我这样做了:

df = df_data[['SalePrice', 'MSSubClass', 'MSZoning', 'LotFrontage', 'LotArea', 'Street', 'Alley', 'LotShape', 'LandContour', 'Utilities']].copy()    

corrmax = df.corr()

f, ax = plt.subplots(figsize=(16,12))
sns.heatmap(corrmax, annot = True)

然后,由于某种原因,得到了只有SalePrice、MSSubClass、LotFrontage和LotArea的热图。谁能帮帮我吗?在


Tags: streetdfdatakaggle列数lotfrontagemssubclasssaleprice
1条回答
网友
1楼 · 发布于 2024-06-01 03:15:47

如果你分析房价数据集House Prices,大约有21-23个分类变量'MSZoning','Alley' corr()矩阵只显示数值或非范畴变量之间的关系

corrmax = df.corr()

如果要查找分类变量和非分类变量之间的关系,请使用Spearman correlation matrix

你可以从下面的链接找到一些帮助。。。在

An overview of correlation measures between categorical and continuous variables

Correlation between a nominal (IV) and a continuous (DV) variable

相关问题 更多 >