I want to convert a 1D numpy array to a simple float (no array). How is that done? Here is my current code with the variable 'acc'.
print type(acc)
print acc.shape
>>> <type 'numpy.ndarray'>
>>> (1,)
Can't you just do:
float(acc)
To make it a float? Seems to be working here:
a = np.array([1])
print a.shape
print type(a)
print float(a)
yields
(1,)
<type 'numpy.ndarray'>
1.0
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With