Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python count of values in array

import numpy as np
y = np.array([0, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 1])
num_zeros = (y == 0).sum()
num_ones = (y == 1).sum()
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #python #count #values #array
ADD COMMENT
Topic
Name
4+9 =