numpy的ValueError的:没有填充功能的数据类型 [英] Numpy ValueError: no fill-function for data-type
问题描述
我知道这没有意义,但是我执行了命令:
I know it doesn't make sense, but I executed the command:
numpy.arange(0, 5, 1, numpy.bool_)
并返回错误 ValueError:数据类型没有填充功能.
.除了布尔值(返回此错误)以外,所有数据类型似乎都可以正常工作.
And it returned an error ValueError: no fill-function for data-type.
. All data types seems to be working except boolean which return this error.
我期望的是 False,True,True,True,True
,是什么原因导致该错误?
I was expecting False, True, True, True, True
, what causes that error?
推荐答案
执行
numpy.arange(0, 2, 1, numpy.bool_)
效果很好,因为 np.bool _
类型对于范围[0,2)仍然有意义.
但是,类型 bool _
??
的范围[0,5)是什么意思这是您得到的错误-numpy试图告诉您您要输入无效范围内的值.
Works fine, becuase np.bool_
type is still meaningful for range [0,2).
However, what is the meaning of range [0,5) for type bool_
??
This is the error you get - numpy tries to tell you that you are asking for values in invalid range.
这篇关于numpy的ValueError的:没有填充功能的数据类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!