gpt4 book ai didi

python - Numpy argsort - 它在做什么?

转载 作者:IT老高 更新时间:2023-10-28 21:08:04 24 4
gpt4 key购买 nike

为什么 numpy 会给出这个结果:

x = numpy.array([1.48,1.41,0.0,0.1])
print x.argsort()

>[2 3 1 0]

当我期望它这样做时:

[3 2 0 1]

显然我对函数的理解不够。

最佳答案

根据the documentation

Returns the indices that would sort an array.

  • 20.0的索引。
  • 30.1的索引。
  • 11.41的索引。
  • 01.48的索引。

关于python - Numpy argsort - 它在做什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17901218/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com