相关矩阵不包括给定数据框中的所有特征

Correlation matrix not including all features in the given dataframe

我有 DataFrame 肾病症状和 class 列来判断一个人是否是患者。 以下是 df.head(10) 给出的数据集示例。 df 中的每个值都是 intfloat 数据类型,没有 str.

当我应用 df.corr() 时,我得到了以下相关矩阵:-

它不包括 DataFrame 中存在的所有功能。你能解释一下背后的原因吗? My complete code is in this git repo

您的数据看起来是数字,但许多列的类型仍然是字符串,请执行以下操作:

x = x.apply(pd.to_numeric)