I have a NumPy array of values. I want to count how many of these values are in a specific range say x<100 and x>25. I have read about the counter, but it seems to on
I think @Sven Marnach answer is quite nice, because it operates in on the numpy array itself which will be fast and efficient (C implementation).
I like to put the test into one condition like 25 < x < 100, so I would probably do it something like this:
25 < x < 100
len([x for x in a.ravel() if 25 < x < 100])