[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)

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM