执行到
print(df.sort(columns="C"))
报错
AttributeError Traceback (most recent call last)
<ipython-input-12-8629de499749> in <module>
----> 1 print(df.sort(columns="C"))
C:\ProgramData\Anaconda3\lib\site-packages\pandas\core\generic.py in __getattr__(self, name)
5065 if self._info_axis._can_hold_identifiers_and_holds_name(name):
5066 return self[name]
-> 5067 return object.__getattribute__(self, name)
5068
5069 def __setattr__(self, name, value):
AttributeError: 'DataFrame' object has no attribute 'sort'
提问了发现后面有答案了,删不掉提问。就自己回答了:改为 print(df.sort_values('C'))