title: Sorting all rows in numpy matrix by target-column
body: <p>This seems been asked many times, however the answer I found not work now. Let's be simple, here I have a numpy matrix</p>
  
  <pre><code>data = np.matrix([[9, 8],
               [7, 6],
               [5, 7],
               [3, 2],
               [1, 0]])
  </code></pre>
  
  <p>Then sort by second column as below</p>
  
  <pre><code>[[1, 0],
  [3, 2],
  [7, 6],
  [5, 7],
  [9, 8]])          
  </code></pre>
  
  <p>I tried a lot examples like <a href="https://stackoverflow.com/questions/13338110/python-matrix-sorting-via-one-column">Python Matrix sorting via one column</a> but none of them worked. </p>
  
  <p>I wondering maybe because the answers were posted years ago which do not work for newest Python? My Python is 3.5.1.</p>
  
  <p>Example of my failed trial:</p>
  
  <pre><code>data = np.matrix([[9, 8],
               [7, 6],
               [5, 7],
               [3, 2],
               [1, 0]])
  temp = data.view(np.ndarray)
  np.lexsort((temp[:, 1], ))
  
  print(temp)
  print(data)
  </code></pre>