title: Array as index in Python
body: <p>I am trying to use an array (<code>mask</code>) which has binary values to modify another array (<code>data</code>), in order to keep only the values where <code>mask</code> is equal to 1</p>
  
  <p>This is my MATLAB example code:</p>
  
  <pre><code>mask = [0 0 0 1 1 0 0];
  
  data = [1 2 3 4 5 6 7];
  
  data(mask == 0) = []
  </code></pre>
  
  <p>My result is then:</p>
  
  <pre><code>data = [4 5]
  </code></pre>
  
  <p>What is the equivalent operation to accomplish this in Python?</p>