使用pandas对excel列排序

2024-10-01 11:29:04 发布

您现在位置:Python中文网/ 问答频道 /正文

我想对名为“LTE_PrbUtil”的excel文件工作表排序,它有一个名为“CELL”的列,它是字符串降序的。 当我运行程序发现错误时:

  File "C:\Users\p4532\Desktop\QGIS_project\highloading.py", line 18, in <module> df = df.sort(columns="CELL")
  File "C:\Python27\lib\site-packages\pandas\core\generic.py", line 3081, in __getattr__
    return object.__getattribute__(self, name)
AttributeError: 'DataFrame' object has no attribute 'sort'`

这是我的代码:

^{pr2}$

数据框似乎无法识别sort。 有人能帮忙吗?在


Tags: 文件字符串inpydfobject排序line