The issue is that a.sort()
does not return the sorted list. It returns None
:
>>> a.sort() is None
True
You could use sorted(a)
:
>>> b = np.array(sorted(a))
>>> b
array([[ 0. , 0.5 ],
[ 1. , 0.3 ],
[ 2. , 0.23]])
However, this would create a (sorted) copy of a
.