Reputation: 7519
I have two numpy arrays that were created by splitting one array. X has 7 columns and Y has 1 column.
I am filtering X with :
X[(X[:,2] != 0) & (X[:,1] != 0) & (X[:,3] != 0) & (X[:,4] != 0)]
This gives me the correct rows of X. How do I get the rows in Y with the matching row indices?
Upvotes: 0
Views: 898
Reputation: 113978
the same way you get X
mask = (X[:,2] != 0) & (X[:,1] != 0) & (X[:,3] != 0) & (X[:,4] != 0)
# mask is a list of [True,False,True,...]
print X[mask]
print Y[mask]
Upvotes: 1