我试图使用pandas.read_excel但我不断收到“‘模块’对象有没有属性‘read_excel’”在我的终端错误,如图pandas.read_excel为什么不运行?
File "read.py", line 9, in <module>
cols = pd.read_excel('laucnty12', 'Poverty Data', index_col='State', \\ na_values=['NA'])
AttributeError: 'module' object has no attribute 'read_excel'
我已经试过pd.read_excel()和pd.io.parsers.read_excel()但得到相同的错误。我安装了python 2.7,熊猫的其他部分可以正常工作,如xls.parse和read_csv。我的代码如下:
import pandas as pd
from pandas import *
xls = pd.ExcelFile('laucnty12.xls')
data = xls.parse('laucnty12', index_col=None, na_values=['NA'])
cols = pd.read_excel('laucnty12', 'Poverty Data', index_col='State', na_values=['NA'])
print cols
你想要做什么,xls.parse不能做什么? (同意,你应该更新熊猫到最新的稳定版本) –