Use .item ()
import numpy as np
#numpy int64
np_int = np.int64(0)
print(type(np_int))
# <class 'numpy.int64'>
#Convert to python int
py_int = np_int.item()
print(type(py_int))
# <class 'int'>
Converting numpy dtypes to native python types
https://stackoverflow.com/questions/9452775/converting-numpy-dtypes-to-native-python-types
Recommended Posts