title: Indexing 2d array bar with another 2d array foo where foo contains row indices for corresponding columns of bar
body: <p>This is best explained with an example..</p>
  
  <pre><code>foo = np.array([
      [0,0],
      [0,1],
      [1,0],
      [1,1]
  ])
  
  bar = np.array([
      [10,12],
      [5,11]
  ])
  
  desired = np.stack((bar[:, 0][foo[:, 0]], bar[:, 1][foo[:, 1]]), axis = 1)
  array([[10, 12],
         [10, 11],
         [ 5, 12],
         [ 5, 11]])
  </code></pre>
  
  <p>So, if you consider the first column of foo <code>[0, 0, 1, 1]</code> and you use those indices to select elements from the first column of bar <code>[10, 5]</code>, you get the first column of my desired result <code>[10, 10, 5, 5]</code>. </p>
  
  <p>The problem is, I'm having trouble figuring out how to generalize this to support an unknown number of rows and columns for foo and bar (and speed is important to me).</p>