title: Find maximum of each row in a numpy array and the corresponding element in another array of the same size
body: <p>I am new to Python and still cannot call myself a Python programmer. Speaking of that, please bear with me if my question does not make any sense.</p>
  
  <h1>Question:</h1>
  
  <p>I have two numpy arrays of the same size, e.g. A and B where A.shape equals B.shape and they both equal (5,1000), and I want to find the maximum value of each row in A and the corresponding element of that in B. For instance, if in fourth row of A, maximum element index is 104 then I would like to find the 104th element of fourth row in array B and the same for the rest of the rows.</p>
  
  <p>I know I can do it by looping over the rows but I was wondering if there was a more elegant way of doing it. For example, if I were to do it in MATLAB I would write the following code:</p>
  
  <pre><code>B(bsxfun(@eq,A,max(A,[],2)))
  </code></pre>
  
  <p>Any help that guides me through the right direction would be much appreciated.</p>