Tag Archives: Python wrong problem set

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 floating-point 2-dimensional array, and initialize all elements to value 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

Change to:

import numpy as np 
e = np.ones((3,3),np.float64)# 3x3 floating-point 2-dimensional array, and initialize all elements to value 1

All right, we’re in the trough