Source From Here
Question
Consider below sample:
I need to find the rows that have true or rows in e whose value are more than 5. I could iterate using a for loop, however, I would like to know if there is a way numpy could do this more efficiently?
How-To
To get the row numbers where at least one item is larger than 5, try numpy.any & numpy.where together:
Question
Consider below sample:
I need to find the rows that have true or rows in e whose value are more than 5. I could iterate using a for loop, however, I would like to know if there is a way numpy could do this more efficiently?
How-To
To get the row numbers where at least one item is larger than 5, try numpy.any & numpy.where together:
沒有留言:
張貼留言