问题描述
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
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
https://blog.csdn.net/c1z2w3456789/article/details/107897067