通過數據下標給數組排序的方法
導入包
import numpy as np
testArray = np.array(["A",2,3,4,5,6,7,8,"B"])
subscriptList = [8,7,6,5,4,3,2,1,0]
print(testArray[subscriptList])
out:
['B' '8' '7' '6' '5' '4' '3' '2' 'A']
通過數據下標給數組排序的方法
導入包
import numpy as np
testArray = np.array(["A",2,3,4,5,6,7,8,"B"])
subscriptList = [8,7,6,5,4,3,2,1,0]
print(testArray[subscriptList])
out:
['B' '8' '7' '6' '5' '4' '3' '2' 'A']