Python求二维数组中某列的最大值

主要运用np.amax()

import numpy as np

help(np.amax)

a = np.arange(9).reshape((3, 3))
max_all = np.amax(a)
max_dimension1 = np.amax(a, axis=0)
max_dimension2 = np.amax(a, axis=1)

print('a:\n',a)
print('max_all:', max_all)
print('max_dimension1:', max_dimension1)
print('max_dimension2:', max_dimension2)

posted @ 2017-08-25 00:02  默盒  阅读(15691)  评论(0编辑  收藏  举报