使用np.argwhere函数得到矩阵最大值的索引

y = np.random.random(5)
print(y)
idx = np.argwhere(y == np.max(y)).flatten()
print(idx,y[idx])

  

posted @ 2021-11-06 20:45  华小电  阅读(379)  评论(0编辑  收藏  举报