我有一个带有形状的numpy数组:
(16L, 360L, 720L)
我如何找到平均值,以便生成的数组具有形状(16)
即我想要 360 轴元素中每个元素的所有 720 * 16 值的平均值。
我试过这个:
np.mean(arr, axis=0)
但这在(360 * 720)
形状上是一致的
有什么作用
np.mean(arr, axis=(1,2)
生产?
来自mean
文档
axis : None or int or tuple of ints, optional
Axis or axes along which the means are computed. The default is to
compute the mean of the flattened array.
.. versionadded: 1.7.0
If this is a tuple of ints, a mean is performed over multiple axes,
instead of a single axis or all the axes as before.