Is it possible to shuffle a numpy array in place by a defined index list?

后端 未结 0 1595
-上瘾入骨i
-上瘾入骨i 2021-01-17 01:13

Re-ordering a numpy array with a given list of indexes, like the following:

arr = np.array([10, 20, 30, 40, 50])
idx = [1, 0, 3, 4, 2]
arr[idx]
相关标签:
回答
  • 消灭零回复
提交回复
热议问题