0
我想将1D numpy数组转换为简单的浮点数(无数组)。 这是如何完成的?这是我现在使用变量'acc'的代码。1D numpy数组浮动
print type(acc)
print acc.shape
>>> <type 'numpy.ndarray'>
>>> (1,)
我想将1D numpy数组转换为简单的浮点数(无数组)。 这是如何完成的?这是我现在使用变量'acc'的代码。1D numpy数组浮动
print type(acc)
print acc.shape
>>> <type 'numpy.ndarray'>
>>> (1,)
你就不能这样做:
float(acc)
使之成为浮动?似乎是在这里工作:
a = np.array([1])
print a.shape
print type(a)
print float(a)
产生
(1,)
<type 'numpy.ndarray'>
1.0