I have two numpy arrays.
x = [[1,2], [3,4], [5,6]]
y = [True, False, True]
I'd like to get the element of X
of which corresponding element of y
is True
:
filtered_x = filter(x,y)
print(filtered_x) # [[1,2], [5,6]] should be shown.
I've tried np.extract
, but it seems work only when x
is 1d array. How do I extract the elements of x
corresponding value of y
is True
?