 <p>You can use <code>sum</code> function:</p> <pre><code>In [52]: m = np.random.randint(0,9,(4,4)) In [53]: m Out[53]: array([[8, 8, 2, 1], [2, 7, 1, 2], [8, 6, 8, 7], [5, 2, 5, 2]]) In [56]: np.sum(m == 8) Out[56]: 4 </code></pre> <p><code>m == 8</code> will return a boolean array contains True for each 8 then since python evaluates the True as 1 you can sum up the array items in order to get the number of intended items. </p>