I have an array and I could find the index of rows of that array that have specific value. now I want to extract all these rows in new array.I used the following code but it produces an error:
finding_all_infValue=np.asarray(BD[BD.min(axis=1) != np.inf])
indx=np.where([BD.min(axis=1) == np.inf])[1]
new_array=BD[indx,:]
what should I do to extract these rows? Thanks
CodePudding user response:
Assuming indx contains an array of indices, you should be able to do:
[BD[x] for x in indx]
which will loop thru your indx list and index BD based on each element.