What is the recommended way to perform a stable sort on a recarray / structured array ?

In the following example, I want to sort on name, while retaining the existing order in the case of equal values:
values = [('a', 1), ('a', 0), ('b', 2)]
dtype = [('name', 'S10'), ('val', 'i4')]
a = np.array(values, dtype=dtype)
array([('a', 1), ('a', 0), ('b', 2)],
dtype=[('name', '|S10'), ('val', '<i4')])
np.sort(a, order='name')
array([('a', 0), ('a', 1), ('b', 2)],
dtype=[('name', '|S10'), ('val', '<i4')])
_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to