np count how many arrays code example
Example 1: how to count positive elements numpy
>>> np.sum(np.array(x) > 0, axis=0)
array([3, 3, 3, 3, 3, 0])
Example 2: numpy count where
print(np.sum(a % 2 == 1))
>>> np.sum(np.array(x) > 0, axis=0)
array([3, 3, 3, 3, 3, 0])
print(np.sum(a % 2 == 1))