title: Python: How to eliminate all the zero rows from a matrix in numpy
body: <p>I have a numpy array of 0 and 1. 
  I need to extract in one pythonic move all the rows that are made up of all 0, and keep the rest.</p>
  
  <p>I have looked for previous questions answering this and it appears that 
  this question is a duplicate of this:
  <a href="https://stackoverflow.com/questions/25333988/remove-all-zero-rows-in-a-2d-matrix">Remove all-zero rows in a 2D matrix</a></p>
  
  <p>But I do not understand any of the answers. It looks like the important command is this:</p>
  
  <pre><code>a[~(a==0).all(1)]
  </code></pre>
  
  <p>but I do not understand how does it extracts a matrix at all. In fact when I use this line in my code it extracts an array, not a 2d matrix.</p>
  
  <p>I have looked at the <code>np.all()</code> <a href="https://docs.scipy.org/doc/numpy-1.10.1/reference/generated/numpy.all.html" rel="nofollow noreferrer">explanation</a>,
  but it looks like it is just a test. </p>
  
  <p>Can someone please help me out.</p>