title: Joining two 2D numpy arrays into a single 2D array of 2-tuples
body: <p>I have two 2D numpy arrays like this, representing the x/y distances between three points. I need the x/y distances as tuples in a single array.</p>
  
  <p>So from:</p>
  
  <pre><code>x_dists = array([[ 0, -1, -2],
                   [ 1,  0, -1],
                   [ 2,  1,  0]])
  
  y_dists = array([[ 0, -1, -2],
                   [ 1,  0, -1],
                   [ 2,  1,  0]])
  </code></pre>
  
  <p>I need:</p>
  
  <pre><code>dists = array([[[ 0,  0], [-1, -1], [-2, -2]],
                 [[ 1,  1], [ 0,  0], [-1, -1]],
                 [[ 2,  2], [ 1,  1], [ 0,  0]]])
  </code></pre>
  
  <p>I've tried using various permutations of dstack/hstack/vstack/concatenate, but none of them seem to do what I want. The actual arrays in code are liable to be gigantic, so iterating over the elements in python and doing the rearrangement "manually" isn't an option speed-wise.</p>
  
  <p><strong>Edit:</strong>
  This is what I came up with in the end: <a href="https://gist.github.com/807656" rel="noreferrer">https://gist.github.com/807656</a></p>