关注微信公共号:小程在线
关注CSDN博客:程志伟的博客
df = pd.read_excel(Location, sheetname=0, index_col='StatusDate') #译者注: 需要 xlrd 包
df.dtypes
Traceback (most recent call last):
File "<ipython-input-6-125ca988f91e>", line 3, in <module>
df = pd.read_excel(Location, sheetname=0, index_col='StatusDate') #译者注: 需要 xlrd 包
File "E:\anaconda3\lib\site-packages\pandas\io\excel\_base.py", line 301, in read_excel
raise TypeError(f"read_excel() got an unexpected keyword argument `{arg}`")
TypeError: read_excel() got an unexpected keyword argument `sheetname`
解决方法:
将sheetname改为sheet_name
df = pd.read_excel(Location, sheet_name=0, index_col='StatusDate') #译者注: 需要 xlrd 包
df.dtypes
Out[7]:
State object
Status int64
CustomerCount int64
dtype: object