title: Finding the indices of the minimum in each 2D array from a 3D array
body: <p>I'm new to numpy and python in general and I am looking to find the minimum of each 2D subarray, given a 3D array. For example:</p>
  <pre><code># construct an example 3D array
  a = np.array([[5,4,1,5], [0,1,2,3], [3,2,8,1]]).astype(np.float32)
  b = np.array([[3,2,9,3], [8,6,5,3], [6,7,2,8]]).astype(np.float32)
  c = np.array([[9,7,6,5], [4,7,6,3], [1,2,3,4]]).astype(np.float32)
  d = np.array([[5,4,9,2], [4,2,6,1], [7,5,9,1]]).astype(np.float32)
  e = np.array([[4,5,2,9], [7,1,5,8], [0,2,6,4]]).astype(np.float32)
  
  a = np.insert(a, 0, [np.inf]*len(a), axis=1)
  b = np.insert(b, 1, [np.inf]*len(b), axis=1)
  c = np.insert(c, 2, [np.inf]*len(c), axis=1)
  d = np.insert(d, 3, [np.inf]*len(d), axis=1)
  e = np.insert(e, 4, [np.inf]*len(e), axis=1)
  
  arr = np.swapaxes(np.dstack((a,b,c,d,e)), 1, 2)
  print(arr) 
  </code></pre>
  <p>gives this result:
  <a href="https://i.stack.imgur.com/bBK26.png" rel="nofollow noreferrer">3D Matrix</a></p>
  <p>The result I'm looking for are the indices of the minimum element from each of the 2D arrays, something like:</p>
  <pre><code>[[0, 0, 3], # corresponding to the coordinates of element with value 1 in the first 2D array
   [1, 0, 1], # corresponding to the coordinates of element with value 0 in the second 2D array
   [2, 4, 0]] # corresponding to the coordinates of element with value 0 in the third 2D array
  </code></pre>
  <p>or something similar along those lines. I plan on using the indices to get that value, then replace the column and row in that 2D subarray with infinite values to find a next minimum that isn't in the same row/column.</p>
  <p>Any help is appreciated, thank you!</p>