[python]numpy.mean()用法
a=np.array([[[1,1],[2,2],[3,3]],[[4,4],[5,5],[6,6]],[[7,7],[8,8],[9,9]],[[10,10],[11,11],[12,12]]]) print a print a.shape b=a.mean(0).shape c=a.mean(1).shape d=a.mean(2).shape print b print c print d
output:
[[[ 1 1] [ 2 2] [ 3 3]] [[ 4 4] [ 5 5] [ 6 6]] [[ 7 7] [ 8 8] [ 9 9]] [[10 10] [11 11] [12 12]]] (4, 3, 2) (3, 2) (4, 2) (4, 3)
兴趣是最好的导师