gpt4 book ai didi

python - 为什么在 Pandas Series 上调用 .sort() 函数会就地对其值进行排序并且什么都不返回?

转载 作者:太空狗 更新时间:2023-10-29 18:03:54 52 4
gpt4 key购买 nike

<分区>

抱歉,我想我在这里遗漏了一些非常基本的东西:

>>> Series([3,4,0,3]).sort()

输出无,而

>>> Series([3,4,0,3]).order()
2 0
0 3
3 3
1 4
dtype: int64

我在 sort() 中遗漏了什么?

谢谢

编辑:

感谢您的回答,我现在确实意识到这是正确的排序。但是我不明白为什么

>>> s = Series([3,4,0,3]).sort()
>>> s

不返回排序后的系列。如果我明白the manual它应该返回排序到位的系列。

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