numpy 切片:整切与索引切片
代码:
x = np.arange(12).reshape(3,4)
print('整切:\n',x[:,[2,3]])# 整切:目标为整行整列
# print(x[[0,1,2],[1,2]]) 索引切片:维度不同会报错
print('索引切片:\n',x[[0,1,2],[1,2,3]])
输出
整切:
[[ 2 3]
[ 6 7]
[10 11]]
索引切片:
[ 1 6 1...
原创
2019-09-20 15:50:24 ·
182 阅读 ·
0 评论