Pandas 熊猫相关函数不';无法处理浮点数据

Pandas 熊猫相关函数不';无法处理浮点数据,pandas,matrix,correlation,Pandas,Matrix,Correlation,我的数据帧包括浮点和二进制伪变量。当尝试创建相关热图时,.corr()函数仅为我的二进制变量创建相关矩阵,并消除其余的。我想知道这种奇怪的行为是否有原因,以及如何解决问题/使用不同的包来创建相关矩阵 以下是我使用的代码: # Heatmap import seaborn as sns import matplotlib.pyplot as plt cols_noCluster= df1.columns df_noCluster = df1[cols_noCluster] corr = df_n

我的数据帧包括浮点和二进制伪变量。当尝试创建相关热图时,.corr()函数仅为我的二进制变量创建相关矩阵,并消除其余的。我想知道这种奇怪的行为是否有原因,以及如何解决问题/使用不同的包来创建相关矩阵

以下是我使用的代码:

# Heatmap

import seaborn as sns
import matplotlib.pyplot as plt
cols_noCluster= df1.columns
df_noCluster = df1[cols_noCluster]
corr = df_noCluster.corr()

f, ax = plt.subplots(figsize=(17, 17))
hm = sns.heatmap(round(corr,2), annot=True, ax=ax, #cmap="coolwarm",
                 fmt='.2f',linewidths=.05)

bottom, top = ax.get_ylim()
ax.set_ylim(bottom + 0.5, top - 0.5)

f.subplots_adjust(top=0.93)
t= f.suptitle('Correlation Heatmap', fontsize=14)

谢谢

您能否发布一些示例代码,包括重现问题的(小)数据帧?拥有a将帮助其他人回答您的问题。请发布您的数据框(假定其名称为
df
)并显示
df.dtypes
。不要粘贴截图。如何粘贴: