小编use*_*912的帖子

在python中使用argsort排序

我尝试对数组进行排序:

import numpy as np

arr = [5,3,7,2,6,34,46,344,545,32,5,22]
print "unsorted"
print arr

np.argsort(arr)

print "sorted"
print arr
Run Code Online (Sandbox Code Playgroud)

但输出是:

unsorted
[5, 3, 7, 2, 6, 34, 46, 344, 545, 32, 5, 22]
sorted
[5, 3, 7, 2, 6, 34, 46, 344, 545, 32, 5, 22]
Run Code Online (Sandbox Code Playgroud)

阵列根本不会改变

python numpy python-2.7

4
推荐指数
3
解决办法
2万
查看次数

标签 统计

numpy ×1

python ×1

python-2.7 ×1