The best way to see what he is doing is a simple example:
In [11]: a = np.array([2, 1, 3])
In [12]: a = np.array([2, 1, 2, 3])
In [13]: b = np.array(['b', 'b', 'a', 'c'])
In [14]: sorted(zip(a, b))
Out[14]: [(1, 'b'), (2, 'a'), (2, 'b'), (3, 'c')]
In [15]: zip(*sorted(zip(a, b)))
Out[15]: [(1, 2, 2, 3), ('b', 'a', 'b', 'c')]
It sorts both lists / arrays with respect to the values ββin the first (they are followed by the values ββin the second).
"" argsort ( ):
In [21]: s = np.argsort(a)
In [22]: a[s], b[s]
Out[22]:
(array([1, 2, 2, 3]), array(['b', 'b', 'a', 'c'],
dtype='|S1'))
: , .