count values in numpy list python

Solutions on MaxInterview for count values in numpy list python by the best coders in the world

showing results for - "count values in numpy list python"
Cristina
06 Feb 2016
1>>> import numpy
2>>> y = np.array([1, 2, 2, 2, 2, 0, 2, 3, 3, 3, 2, 2])
3
4>>> numpy.count_nonzero(y == 1)
51
6>>> numpy.count_nonzero(y == 2)
77
8>>> numpy.count_nonzero(y == 3)
93