Liw*_*Liw 4 python arrays indexing numpy list
我有一个数字数组,最大值可能会出现不止一次.
是否可以通过使用像numpy.argmax这样的东西找到最后一次出现的最大值的索引?
或者,更好的是,是否可以获得数组中所有最大值出现的索引列表?
eum*_*iro 8
import numpy as np a = np.array((1,2,3,2,3,2,1,3)) occurences = np.where(a == a.max()) # occurences == array([2, 4, 7])
归档时间:
14 年,1 月 前
查看次数:
8232 次
最近记录: