2017-10-17 59 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'已被棄用。 –

回答