title: How do I count the number of nonzero values in a given array column?
body: <p>I have an array that is as follows:</p>
  
  <pre><code>[[0, 0, 0, 1],
   [1, 0, 0, 0],
   [0, 1, 0, 0],
   [0, 0, 1, 0],
   [0, 0, 0, 1],
   etc
  </code></pre>
  
  <p>I'd like to determine the sum of index [3] in each line. 
  For example, here I'd like to get <code>2</code> as a result.</p>
  
  <p>I'm trying </p>
  
  <pre><code>np.sum(np.count_nonzero(array[:][3], axis=1))
  </code></pre>
  
  <p>but I get an out of bounds error. Any ideas?</p>