当我在spyder中生成相关矩阵时,其生成正确 使用5行x 5列的数据框。但是,当我在jupyter笔记本中运行相同的代码时,它会给出'TypeError'
“数据”是我的实际数据框,其中包含带有字符串值的列。 从中我删除了一些我不需要的列。 并创建了一个名为“测试”的新数据框
test = data.iloc[:5]
test.head()
test.drop(['Day_Perc_Change','Deliverable
Qty','Symbol','Month','Year','Prev Close','Open Price','High Price','Low
Price','Last Price','No. of Trades','Turnover','Date','Series'],axis=1,
inplace = True)
test.head()
import seaborn as sns
# Calculate and show pairplot
sns.pairplot(test, size=2.5)
plt.tight_layout()
cm = np.corrcoef(test.values.T)
sns.set(font_scale=1.5)
hm = sns.heatmap(cm,cbar=True,annot=True,square=True,fmt='.2f',annot_kws=
{'size': 15})
TypeError Traceback (most recent call
last)
<ipython-input-21-83bb9c495782> in <module>()
1 # To analyse the relation between various attributes,correlation matrix
is important
TypeError: unsupported operand type(s) for /: 'str' and 'int'