2020-04-28
阅读量:
1055
jupyter报its size must be a divisor of the total size in bytes of the last axis of the array的错误

dtype属性代表array中数据的类型,可以是int,float,str等
a.dtype
dtype('int32')
dtype属性的修改不可以直接进行,而应该借助于astype()方法
a.dtype = "float64"
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-18-a4cdf5bd3aee> in <module>()
----> 1 a.dtype = "float64"
ValueError: When changing to a larger dtype, its size must be a divisor of the total size in bytes of the last axis of the array.
a = a.astype(np.float64)
print(a)
print(a.dtype)
[[[ 0. 1. 2. 3. 4.]
[ 5. 6. 7. 8. 9.]]
[[10. 11. 12. 13. 14.]
[15. 16. 17. 18. 19.]]]
float64






评论(0)


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