import numpy as np
a = np.array([[2, 4, 6, 1], [1, 5, 2, 9]])
print(np.argmax(a))
print(np.argmax(a, axis=0)) #竖着比较,返回行号
print(np.argmax(a, axis=1)) #横着比较,返回列号
输出:
7
[0 1 0 1]
[2 3]
来源:CSDN
作者:w112112_
链接:https://blog.csdn.net/w112112_/article/details/103809940