python 寻找list中最大元素对应的索引

python 寻找list中最大元素对应的索引
参考:http://blog.csdn.net/nov_csdn/article/details/52959346
aa = [1,2,3,4,5]

aa.index(max(aa))

如果aa是numpy数组:

aa = numpy.array([1,2,3,4,5])

先把aa转换为List,再求索引:

bb = aa.tolist()

bb.index(max(bb))

猜你喜欢

转载自blog.csdn.net/weixin_43758551/article/details/89211294