python - cannot make corr work

后端 未结 2 1614
臣服心动
臣服心动 2020-12-20 15:06

I\'m struggling with getting a simple correlation done. I\'ve tried all that was suggested under similar questions.

Here are the relevant parts of the code, the vari

相关标签:
2条回答
  • 2020-12-20 15:15

    You can try as following:

    Top15['Citable docs per capita']=(Top15['Citable docs per capita']*100000)
    Top15['Citable docs per capita'].astype('int').corr(Top15['Energy Supply per Capita'].astype('int'))
    

    It worked for me.

    0 讨论(0)
  • 2020-12-20 15:34

    Well, I've encountered the same problem today. try use .astype('float64') to help make the type correct.
    data['ESA Index_close_px'][5:50].astype('float64').corr(data['CCMP Index_close_px'][5:50].astype('float64'))

    This works well for me. Hope it can help you as well.

    0 讨论(0)
提交回复
热议问题