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?
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]
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.