numpy - Python sort 2D Array by using np.argosrt list entrys -


i reshaped given x,y data np.reshape(x or y,(40,30)). next need sort y-values ascending order, used:

y_sort=np.argsort(y,axis=-1) print y_sort [[1 10 6 84 20 ..           5 240 63 88...]] 

next want try use index list sorting "new" y-2d array with

y_new=y[y_sort] 

now got y_new tuple of 40,30,30

i want sort y-values of origin 2d array respect given indices y_sort, resulting in 2d array of size 40,30

what doing wrong here?

thanks help

the problem numpy's arg* functions should not used index. mention in numpy.argwhere tested several of them , of tested arg* functions trigger advanced indexing (see numpy documentation).

probably numpy.sort suitable function sorting.


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -