import numpy as npl = np.array([1, -2, 10, -12, -4, -5, 9, 2])l[np.lexsort((l, l < 0))]array([ 1, 2, 9, 10, -12, -5, -4, -2])
↧
Answer by piRSquared for How do I sort a list with positives coming before negatives with values sorted respectively?
↧