python3.x - python3.5的numpy设置array为float64,报错"name float64 is not defined"
本文介绍了python3.x - 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
请问应该如何显式转换呢?
解决方案
会不会,你没有import float64
你这样字面上这样import当然不对啊。。
这样。。
import numpy as np
dtype=np.float64
这篇关于python3.x - python3.5的numpy设置array为float64,报错"name float64 is not defined"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文