【Numpy】np.argmax()
1.对一个一维向量
import numpy as np
a = np.array([3, 1, 2, 4, 6, 1])
b=np.argmax(a)#取出a中元素最大值所对应的索引,此时最大值位6,其对应的位置索引值为4,(索引值默认从0开始)
print(b)#4
2.对2维向量(通常意义下的矩阵)a[][]
import numpy as np
a = np.array([[1,...
转载
2019-08-01 11:05:13 ·
181 阅读 ·
0 评论