python - .corr() - Correlation ignores columns with numeric data
问题描述
I am trying to use df.corr()
on a DataFrame and it is not returning correlation for all columns. Interestingly, it ignores the columns which are grey.
Screen shot of DataFrame
I assign value to the 'grey' columns like that (with a for loop going through m
):
Result_ARES.at[Result_ARES.NORAD==m,'popt0'] = popt[0]
I thought it might be a type issue. But type(popt[0])
is a numpy.float64
.
Any ideas what I can do to rectify this?
Thank you,
解决方案
The 'data' in the column might have been a float but it was indexed as an object.
The solution was to change all datatypes to float64
using this line of code:
Result_ARES = Result_ARES.astype('float64')
推荐阅读
- azure - 如何设置 app.UseOAuthBearerAuthentication 来处理不同的 Azure B2C 自定义策略?
- e2e-testing - cy.getBy*** 不是函数
- python - plotfly 袖扣不会创建情节
- android - 单击输入元素会将已安装的 Web 应用程序从“独立”更改为“最小 UI”
- performance - 如何索引 cosmosDB 中的缺失值?
- google-apps-script - 如何创建一个在 K 列的第一个空单元格中写入日期的按钮
- excel - 有没有办法在多个 VBA 脚本中使用相同的代码?
- scala - 使用 spark databricks 平台从 URL 读取数据
- javascript - 为什么我的程序会中断?为什么我会收到此错误?
- c# - 如何处理多个值的 DBNull 异常