title: Python Matrix sorting via one column
body: <p>I have a <em>n</em> x <em>2</em> matrix of integers. The first column is a series 0,1,-1,2,-2, however these are in the order that they were compiled in from their constituent matrices. The second column is a list of indices from another list.</p>
  
  <p>I would like to sort the matrix via this second column. This would be equivalent to selecting two columns of data in Excel, and sorting via Column B (where the data is in columns A and B). Keep in mind, the adjacent data in the first column of each row should be kept with its respective second column counterpart. I have looked at solutions using the following:                      </p>
  
  <pre><code>data[np.argsort(data[:, 0])]
  </code></pre>
  
  <p>But this does not seem to work. The matrix in question looks like this:</p>
  
  <pre><code>matrix([[1, 1],
          [1, 3],
          [1, 7],
          ..., 
          [2, 1021],
          [2, 1040],
          [2, 1052]])
  </code></pre>