numpy array count elements code example
Example 1: np array value count
unique_elements, counts_elements = np.unique(a, return_counts=True)
Example 2: how to count positive elements numpy
>>> np.sum(np.array(x) > 0, axis=0)
array([3, 3, 3, 3, 3, 0])
Example 3: numpy count where
print(np.sum(a % 2 == 1))