To silence this warning, use `float` by itself. Doing this will not modify any behavior and is safe.

import numpy as np 
e = np.ones((3,3),np.float)# 3x3的浮点型2维数组,并且初始化所有元素值为1

D:\projects\Numpy\array.py:25: DeprecationWarning:

np.float is a deprecated alias for the builtin float.

To silence this warning, use float by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use np.float64 here.
Deprecated in NumPy 1.20;

for more details and guidance:

https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
已经给出解释了 就不看这引导了 妹的!

改成:

import numpy as np 
e = np.ones((3,3),np.float64)# 3x3的浮点型2维数组,并且初始化所有元素值为1

好了 卧槽了!!!!!!!!

你可能感兴趣的:(Python错题集,python,numpy)