2017-05-05 276 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

回答

相关问题