【发布时间】:2020-01-20 22:55:51
【问题描述】:
我有一个大小为 (15 x 200 x 3) 的 numpy 数组,称为 rap。 我想根据这样的二维列表对其进行切片:
fragment = [0 93
7 102
6 43
11 167]
这基本上是我想要返回的原始 3d 数组的前两个索引的列表。
当我尝试这样做时它会出错:
rap_sliced = rap[fragment, :]
或
rap_sliced = rap[list(fragment), :]
rap_sliced = rap[fragment]
我做错了什么?
【问题讨论】:
-
结果的形状是什么?
-
您需要提供2个列表,每个索引一个
标签: python numpy multidimensional-array indexing slice