numpy.ndarray count code example
Example 1: np array value count
unique_elements, counts_elements = np.unique(a, return_counts=True)
Example 2: numpy count where
print(np.sum(a % 2 == 1))
unique_elements, counts_elements = np.unique(a, return_counts=True)
print(np.sum(a % 2 == 1))