I am interested in sorting a matrix of type
a = array([[1,2,3],[4,5,6],[0,0,1]])
by some column as discussed here. One straight forward answer given there is
a[a[:,1].argsort()]
However, this seems to break the array in some cases as also commented there. In my case I start with a np.array
of .shape
(a,b)
. After the above code, I end up with an array of .shape
(a,1,b)
. What are potential reasons for this behaviour?