我有一个矩阵和一个布尔向量:
>>>from numpy import *
>>>a = arange(20).reshape(4,5)
array([[ 0, 1, 2, 3, 4],
[ 5, 6, 7, 8, 9],
[10, 11, 12, 13, 14],
[15, 16, 17, 18, 19]])
>>>b = asarray( [1, 1, 0, 1] ).reshape(-1,1)
array([[1],
[1],
[0],
[1]])
现在,我希望选择矩阵中所有与向量中相应索引相等的零对应行。>>>a[b==0]
array([10])
我该如何使其返回特定的行?
[10, 11, 12, 13, 14]