带有pandas.read_excel的TypeError [英] TypeError with pandas.read_excel

查看:743
本文介绍了带有pandas.read_excel的TypeError的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法加载xlsx文件

I can't load the xlsx file

import pandas
y=pandas.read_excel("as.xlsx",sheetname=0)
y

这是错误消息

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`

推荐答案

您遇到语法错误

尝试

y=pandas.read_excel("as.xlsx",sheet_name=0)

这篇关于带有pandas.read_excel的TypeError的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆