python - Sort numpy array by row and order matching values based on original array -
I have a 2D number and I want to sort the rows based on the first column values. The problem is that it has been formatted:
I'm sorting by column: 0,1,2,3,4,0,1,2,3,4,0,1,2 , 3, 4, etc. - & gt; You can see that it repeats itself
Actually I want to group 1s, then 2s, then 3s, then 4s. Importance of the order of mailing value: I need to have the first '1' row in the first one, which is displayed without any sort of array, after which there is one etc. I use this command: sortedData = myData [myData [,, 0] .argsort ()]
Unfortunately, it does not appear in the order of matching columns based on the original order of the array is. Are there some options that I can turn on to enable it?
Thank you!
You can change the sorting algorithm being used by the argument .
Use
(An stable sorting algorithm.)
Comments
Post a Comment