【发布时间】:2016-06-16 13:14:56
【问题描述】:
我有以下 numpy 数组:
boxIDx = 3
index = np.array([boxIDs!=boxIDx]).reshape(-1,1)
print('\nbboxes:\t\n', bboxes)
print('\nboxIDs:\t\n', boxIDs)
print('\nIndex:\t\n', index)
输出是:
bboxes:
[[370 205 40 40]
[200 100 40 40]
[ 30 50 40 40]]
boxIDs:
[[1]
[2]
[3]]
Index:
[[ True]
[ True]
[False]]
问题:如何使用我的索引“删除”第三行(bbox)?
我试过了:
bboxes = bboxes[index,:]
还有:
bboxes = bboxes[boxIDs!=boxIDx,:]
这两个都给我以下错误:
IndexError: too many indices for array
对不起,如果这是愚蠢的 - 但我在这里遇到了麻烦:/
【问题讨论】:
标签: python python-3.x numpy indexing