ktl014
5/31/2017 - 4:16 AM

From https://stackoverflow.com/questions/28341387/zip-sorted-and-pandas Using pandas zip

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')]