title: What is the sorting logic behind np.lexsort?
body: <p>How does this function work?</p>
  
  <pre><code>import numpy as np
  first_names = (5,5,5)
  last_names = (3,1,2)
  x = np.lexsort((first_names, last_names))
  print(x)
  </code></pre>
  
  <p>It gives output [1 2 0] . I assume that the two lists are sorted by the variable last_names. If so, how can number 2 have index 0.   2 is between 1 and 3, so I don't understand how this sorting works. please explain.</p>