使用python中出现的错误统计

末鹿安然 提交于 2020-11-23 22:51:08

1, unsupported operand type(s) for /: 'map' and 'int'

机器学习实战 PCA程序

Traceback (most recent call last):

  File "<ipython-input-29-808c65c1265e>", line 1, in <module>
    lowDMat,reconMat=pca.pca(dataMat,1)

  File "I:\python\PCA\pca.py", line 15, in pca
    meanVals = mean(dataMat, axis=0)

解决办法:

2 ,TypeError: ufunc 'isnan' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe''

Traceback (most recent call last):

  File "<ipython-input-17-945c872e5152>", line 1, in <module>
    dataMat=pca.replaceNanWithMean()

  File "I:\python\PCA\pca.py", line 59, in replaceNanWithMean
    meanVal = mean(datMat[nonzero(~isnan(datMat[:,i].A))[0],i])

TypeError: ufunc 'isnan' not supported for the input types, and the inputs could not be 
safely coerced to any supported types according to the casting rule ''safe''

 

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!