title: NumPy selecting specific column index per row by using a list of indexes
body: <p>I'm struggling to select the specific columns per row of a NumPy matrix.</p>
  <p>Suppose I have the following matrix which I would call <code>X</code>:</p>
  <pre><code>[1, 2, 3]
  [4, 5, 6]
  [7, 8, 9]
  </code></pre>
  <p>I also have a <code>list</code> of column indexes per every row which I would call <code>Y</code>:</p>
  <pre><code>[1, 0, 2]
  </code></pre>
  <p>I need to get the values:</p>
  <pre><code>[2]
  [4]
  [9]
  </code></pre>
  <p>Instead of a <code>list</code> with indexes <code>Y</code>, I can also produce a matrix with the same shape as <code>X</code> where every column is a <code>bool</code> / <code>int</code> in the range 0-1 value, indicating whether this is the required column.</p>
  <pre><code>[0, 1, 0]
  [1, 0, 0]
  [0, 0, 1]
  </code></pre>
  <p>I know this can be done with iterating over the array and selecting the column values I need. However, this will be executed frequently on big arrays of data and that's why it has to run as fast as it can.</p>
  <p><strong>I was thus wondering if there is a better solution?</strong></p>