title: Creating a new array from a subset of another one
body: <p>I need to create an array, correct_data, that is a subset of another one, all_data. This is all_data:</p>
  <pre><code>all_data = np.array([[[ 0, 11, 12, 13, 14],
                        [ 0, 21, 22, 23, 24],
                        [ 1, 31, 32, 33, 34],
                        [ 0, 41, 42, 43, 44]]])
  </code></pre>
  <p>The array correct_data will have all the the rows in all_data where the first item is a 1.
  The way I was doing it is by creating a mask that identifies the rows starting with 1, such as:</p>
  <p><code>correct_mask=all_data[:,0]==1</code></p>
  <p>and then identifies the indexes of such rows (using &quot;where&quot;).</p>
  <p>Then I create a for loop that takes each row from the index and copy it onto correct_data (using vstack?).
  Is this a practical way of doing it? If so, I need to create at fist correct_data as an empty array: can this be done?</p>
  <p>Alternatively, I have tried to do it in a different way, i.e., delete the rows starting with a 0 from all_data</p>
  <p>This is what I was trying:</p>
  <pre><code>for row in range(len(all_data)):
      this_row=all_data[row]
      if (this_row[0])==0:
          np.delete(all_data,row,0)
  </code></pre>
  <p>This does delete the rows, but then again how do I store the remaining rows in a new (or the same) array?</p>
  <p>Many thanks for any help and clarification (I have a very basic knowledge of Python).</p>