python - 反向排序python中的二维numpy数组

标签 python numpy

我有一个像这样的 numpy 数组:

A = array([[-inf,  4,  5,  10, -inf, 1],
            [-inf,  2,  6, 8, -inf, 1],
            [-inf,  4,  -inf,  10, -inf, 100]
      ])

I need to sort in a decreasing order: 

A = array ([ 10,5,4,1,-inf,-inf], 
          [8,6,2,1,-inf,-inf],
           [100,10,4,-inf,-inf,-inf]])

这里的-inffloat('-inf') 我该怎么做?

我试过这个: 排序(A,key=lambda listA:len(listA),reverse=True)

但是我没有得到排序的数组。有人可以告诉我该怎么做吗?

最佳答案

关于python - 反向排序python中的二维numpy数组,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27054368/

相关文章:

Python 值传递给构造函数,变量仍然为空

python - 尝试安装 python asyncio 时失败

python - 将 numpy 数组从值转换为索引

python - 将数组转换为百分位数

python - 从 3d numpy 数组中删除 2d 切片

python - Google Colab : loading large image dataset is very long, 上的深度学习如何加速这个过程?

python - 当我想通过终端运行特定命令时,如何使用 VScode 的调试器?

python - 使用 python 和 selenium 抓取动态网页

python - Python 中 2 的幂的列表理解因 numpy 数组而失败

python - numpy 的百分位数函数究竟做了什么?