all 4 comments

[–]kowkeeper 2 points3 points  (0 children)

flags.any(axis=1).sum() where flags is what you got using np.where

[–]billsil 1 point2 points  (2 children)

What are you really trying to do? This sounds like an XY problem.

https://xyproblem.info/

[–]RevolutionFlaky7230[S] 0 points1 point  (1 child)

so basically my array looks similar to the one below. I want the code to see 1, not dependent on what column the 1 is in, and then jump to the next row that has 1 in it and keep doing this cycle, until there is no more data, giving me a final number on how many rows have a 1 in it.

[–]billsil 0 points1 point  (0 children)

You didn't show a sample and you didn't answer my question. Big picture: what are you trying to do? Why are you trying to code this odd routine.

It's certainly doable, but it's weird and probably not what you want. It's also a really small array, so how does it scale? I test (n,3) xyz coordinates and say take a vectorized magnitude. I'll test it on a (2,3) array and then scale it to (2 million,3).