numpy整数数组索引
import numpy as np
x = np.array([[0,1,2],[3,4,5],[6,7,8],[9,10,11]])
rows = np.array([[0,0],[3,3]])
print(rows)
cols = np.array([[0,2],[0,2]])
print(cols)
y = x[rows,cols]
0,0
0,2
3,0
3,2
print(y)
———...
转载
2019-10-09 19:24:49 ·
705 阅读 ·
0 评论