title: Appending elements with similar index in Python
body: <p>I want to append elements of <code>A (shape=(1,10,2))</code> with the same <code>j</code> to create a new array <code>A1</code>. For example, <code>[1,3]</code> and <code>[2,3]</code> should be appended into one element because of same <code>j</code> (=3) and different <code>i</code> (=1 and =2 respectively). The desired output is attached.</p>
  <pre><code>import numpy as np
  A=np.array([[
          [0, 1],
          [0, 2],
          [1, 3],
          [2, 3],
          [2, 4],
          [3, 5],
          [3, 6],
          [4, 6],
          [5, 7],
          [6, 7]]])
  </code></pre>
  <p>The desired output is</p>
  <pre><code>A1=array([[
          [0, 1],
          [0, 2],
          [[1, 3],[2, 3]],
          [2, 4],
          [3, 5],
          [[3, 6],[4, 6]],
          [[5, 7],[6, 7]]]])
  A1.shape=(1,7,2)
  </code></pre>