2019-01-30
阅读量:
3025
name float64 is not defined
python3.5的numpy设置array为float64,报错"name float64 is not defined"
trainWeights = gradDescent(np.array(trainingSet,dtype=float64), trainingLabels)
把dtype设置为float64会报错 NameError: name 'float64' is not defined
但是如果去掉"dtype=float64"会出现warning:DataConversionWarning: Data with input dtype <U3 was converted to float64 by MinMaxScaler.
warnings.warn(msg, DataConversionWarning) 提醒被转换成了float64
请问应该如何显式转换呢?
float64是numpy下的一个类,你如果想要前面不加修饰的使用float64需要这样导入
import numpy as np
from numpy import float64
答:float64是numpy下的一个类,你如果想要前面不加修饰的使用float64需要这样导入
import numpy as np
from numpy import float64
c = np.array([], dtype=float64)
如果没有from numpy import float64,使用时要这样
c = np.array([], dtype=np.float64)






评论(0)


暂无数据
推荐帖子
0条评论
0条评论
0条评论