一聚教程网:一个值得你收藏的教程网站

最新下载

热门教程

python numpy 部分排序 寻找最大的前几个数的方法

时间:2018-07-02 编辑:猪哥 来源:一聚教程网

如下所示:

import numpy as np
K=4
a = np.array([0, 8, 0, 4, 5, 8, 8, 0, 4, 2])
a[np.argpartition(a,-K)[-K:]]

热门栏目