用Python中的另一个数组对数组的行进行排序 [英] Sort array's rows by another array in Python

查看:1030
本文介绍了用Python中的另一个数组对数组的行进行排序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试按另一个数组的值对一个数组的行进行排序.例如:

I'm trying to sort the rows of one array by the values of another. For example:

import numpy as np
arr1 = np.random.normal(1, 1, 80)
arr2 = np.random.normal(1,1, (80,100))

我想按降序对arr1进行排序,并保持arr1和arr2之间的当前关系(即,对c2>和arr2[0, :]的行进行排序后都一样).

I want to sort arr1 in descending order, and to have the current relationship between arr1 and arr2 to be maintained (ie, after sorting both, the row of arr1[0] and arr2[0, :] are the same).

推荐答案

使用此示例以降序排列.

这篇关于用Python中的另一个数组对数组的行进行排序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆