2017-10-17 83 views
1

我想排序称为“LTE_PrbUtil”的excel文件工作表,它有一个名为“CELL”的字符串降序列。 当我运行该程序,并找到了一些错误:使用熊猫排序excel列

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'` 

这里是我的代码:

import shutil 
import pandas as pd 
import xlrd 
xl=pd.ExcelFile("C:\Users\p4532\Desktop\QGIS_project\HighUtilCells_new.xlsx")                   
df = xl.parse("LTE_PrbUtil") 
df = df.sort(columns="CELL") 

看来数据帧不能识别sort。 任何人都可以帮忙吗?

+0

'sort'已被弃用。 –

回答