pandas.read_excel 的类型错误
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/57348149/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 06:24:21 来源:igfitidea点击:
TypeError with pandas.read_excel
提问by souvik dan
I can't load the xlsx file
我无法加载 xlsx 文件
import pandas
y=pandas.read_excel("as.xlsx",sheetname=0)
y
This is the error message
这是错误信息
TypeError Traceback (most recent call last)
<ipython-input-5-54208838b8e5> in <module>
1 import pandas
----> 2 y=pandas.read_excel("as.xlsx",sheetname=0)
3 y
c:\users\lenovo-pc\appdata\local\programs\python\python37\lib\site-packages\pandas\util\_decorators.py in wrapper(*args, **kwargs)
206 else:
207 kwargs[new_arg_name] = new_arg_value
--> 208 return func(*args, **kwargs)
209
210 return wrapper
c:\users\lenovo-pc\appdata\local\programs\python\python37\lib\site-packages\pandas\io\excel\_base.py in read_excel(io, sheet_name, header, names, index_col, usecols, squeeze, dtype, engine, converters, true_values, false_values, skiprows, nrows, na_values, keep_default_na, verbose, parse_dates, date_parser, thousands, comment, skip_footer, skipfooter, convert_float, mangle_dupe_cols, **kwds)
304 if arg in kwds:
305 raise TypeError(
--> 306 "read_excel() got an unexpected keyword argument " "`{}`".format(arg)
307 )
308
TypeError: read_excel() got an unexpected keyword argument `sheetname`
回答by Neha Jirafe
You have a syntax error
你有一个语法错误
Try
尝试
y=pandas.read_excel("as.xlsx",sheet_name=0)