'Series' object has no attribute 'order'

obj2 = Series([4,2,6,1])

obj2
Out[25]: 
0    4
1    2
2    6
3    1
dtype: int64

obj2.order()
Traceback (most recent call last):

  File "<ipython-input-26-b2fce9a039d7>", line 1, in <module>
    obj2.order()

  File "C:\D\anaconda\lib\site-packages\pandas\core\generic.py", line 4376, in __getattr__
    return object.__getattribute__(self, name)

AttributeError: 'Series' object has no attribute 'order'

在练习时发现order用不了,百度了一下,使用sort_value()解决

obj2.sort_values()
Out[28]: 
3    1
1    2
0    4
2    6
dtype: int64

猜你喜欢

转载自blog.csdn.net/weixin_43139613/article/details/82856182