Write a NumPy program to convert numpy dtypes to native python types.
import numpy as np print("numpy.float32 to python float") x = np.float32(0) print(type(x)) pyval = x.item() print(type(pyval))
Sample Output:
numpy.float32 to python float <class 'numpy.float32'> <class 'float'>
total answers (1)
start bookmarking useful questions and collections and save it into your own study-lists, login now to start creating your own collections.
Sample Output: