考虑以下数据集(作为 pandas df 导入):
Chinese Yuan Euro Japanese Yen U.K. Pound Sterling U.S. Dollar Indian Rupee
9.29446 1.25367 143.645 1.05054 1.39596 94.1451
9.31515 1.25322 142.715 1.06143 1.39684 94.1513
9.31697 1.25834 140.54 1.073 1.39286 NA
9.31315 1.25737 140.64 1.06911 1.39316 94.0345
9.3135 1.25797 140.51 1.07261 1.39257 93.9408
9.29403 1.25769 139.962 1.0705 1.38962 93.3027
9.31021 1.2549 143.369 1.05762 1.39194 93.4641
9.3135 1.25716 145.178 1.0468 1.39193 93.5445
9.30432 1.24695 144.895 1.05236 1.39122 93.0917
9.31532 1.25263 147.268 1.04242 1.39392 NA
9.30354 1.25652 NA 1.04952 1.38883 93.1923
我想做的是找出Indian Rupee所有其他货币的相关性,为此,我正在尝试使用以下python代码:
df['Indian Rupee'].corr(~df['Indian Rupee'])
上面抛出了一个错误:
TypeError: ufunc 'invert' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe''
我想了解为什么会出现上述错误?为什么我不能以这种方式找到相关性?
我在这里有什么选择?