title: Remove duplicate index in 2D array
body: <p>I have this 2D numpy array here:</p>
  <pre class="lang-python prettyprint-override"><code>arr = np.array([[1,2],
                  [2,2],
                  [3,2],
                  [4,2],
                  [5,3]])
  </code></pre>
  <p>I would like to delete all duplicates corresponding to the previous index at index 1 and get an output like so:</p>
  <pre class="lang-python prettyprint-override"><code>np.array([[1,2],
            [5,3]])
  </code></pre>
  <p>However, when I try my code it errors.
  Here is my code:</p>
  <pre class="lang-python prettyprint-override"><code>for x in range(0, len(arr)):
      if arr[x][1] == arr[x-1][1]:
          arr = np.delete(arr, x, 0)
  
  &gt;&gt;&gt; IndexError: index 3 is out of bounds for axis 0 with size 2
  </code></pre>