9/20/2021

convert numpy.ndarray object to float


*Here is object dtype numpy.ndarray
print(oneD_pt.dtype, type(oneD_pt), oneD_pt)
> object <class 'numpy.ndarray'> [3 2 1 2 2] 

* convert float dtype numpy.ndarray
oneD_pt=oneD_pt.astype('float')
print(oneD_pt.dtype, type(oneD_pt), oneD_pt)
> float64 <class 'numpy.ndarray'> [3. 2. 1. 2. 2.]


thank you.