首页 > 编程语言 > 详细

numpy 数组的axis

时间:2017-01-25 12:39:10      阅读:285      评论:0      收藏:0      [点我收藏+]

numpy中的axis怎么理解:数组的维数,比如4*5数组,行为axis=1,列为axis=0

eg:

a = np.arange(20).reshape(4,5)
print "a:"
print a

print "maximum element in each row of a: " + str(a.max(axis=1))
print "minimum element in each column of a: " + str(a.min(axis=0))

 

a:
[[ 0 1 2 3 4] [ 5 6 7 8 9] [10 11 12 13 14] [15 16 17 18 19]]
maximum element in each row of a: [ 4 9 14 19]
minimum element in each column of a: [0 1 2 3 4]

numpy 数组的axis

原文:http://www.cnblogs.com/amanon/p/6349251.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!