2017-05-05 277 views
1

我想讀取Excel文件中的蟒蛇,但我得到的錯誤數據框中AttributeError的: '據幀' 對象有沒有屬性 'ICOL'

Attribute error: 'Dataframe' object has no attribute 'icol' 

代碼:

import pandas as pd 
    import numpy as np 

    file = pd.ExcelFile("reports.xlsx") 
    sheet = pd.read_excel("reports.xlsx",sheetname=0) 

    item = sheet.icol(0) 
    amount = sheet.icol(1) 

其他詳情:Python的3.6.1 &的Windows 10

請檢查:

1)Sample Excel file

2)Error

+0

哪個pandas版本? icol被推翻http://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.icol.html –

+0

哦! icol已棄用。謝謝@ e.arbitrio!現在我已經使用.iloc [:,i] – anashamidkh

回答

相關問題