title: numpy 2D array assignment with 2D value and indices arrays
body: <p>My goal is to assign the values of an existing 2D array, or create a new array, using two 2D arrays of the same shape, one with values and one with indices to assign the corresponding value to.</p>
  
  <pre><code>X = np.array([range(5),range(5)])
  X
  array([[0, 1, 2, 3, 4],
         [0, 1, 2, 3, 4]])
  
  Y= np.array([range(5), [2,3,4,1,0]])
  Y
  array([[0, 1, 2, 3, 4],
         [2, 3, 4, 1, 0]])
  </code></pre>
  
  <p>My desired output is an array of the same shape as X and Y, with the values of X given in the index from the corresponding row in Y.  This result can be achieved by looping through each row in the following way:</p>
  
  <pre><code>output = np.zeros(X.shape)
  
  for i in range(X.shape[0]):
      output[i][Y[i]] = X[i]
  output 
  array([[ 0.,  1.,  2.,  3.,  4.],
         [ 4.,  3.,  0.,  1.,  2.]])
  </code></pre>
  
  <p>Is there a more efficient way to apply this sort of assignment? </p>
  
  <pre><code>np.take(output, Y) 
  </code></pre>
  
  <p>Will return the items in the output array I would like to assign to the values of X to, but I believe np.take does not produce a reference to the original array, and instead a new array.</p>