使用jupyter notebook读取xlsx表格时报错

使用jupyter notebook读取xlsx表格时报错:
module 'pandas' has no attribute 'read_xlsx'
在网上找过后都提到:有python,py,Excel,xlsx等的同名文件,但是改文件名,移除了所有文件,依旧没有解决。哪位能帮忙解决一下啊?
下边是代码:

1import pandas as pd 
2、from pandas import Series,DataFrame
3import numpy as np
4import matplotlib as plt
5、%matplotlib inline
1、hero=pd.read_xlsx(hero.xlsx)
2、hero.head()

结果:
**AttributeError Traceback (most recent call last)
~\AppData\Local\Temp\ipykernel_28620\3874637881.py in
----> 1 hero=pd.read_xlsx(hero.xlsx)
2 hero.head()

D:\anaconda\lib\site-packages\pandas_init_.py in getattr(name)
259 return _SparseArray
260
--> 261 raise AttributeError(f"module 'pandas' has no attribute '{name}'")
262
263

AttributeError: module 'pandas' has no attribute 'read_xlsx'**

emm...
咱就说,您这错误相当可爱。

pandas库读取.xlsx文件的函数是 read_excel ,不是read_xlsx。

所以赶快把脚本里所有的pd.read_xlsx都换成pd.read_excel吧。

另外吐槽一句:下一次遇到问题,先不要着急各种操作,而是应该耐着性子 先把报错信息读一读. 。

读懂了,问题自然就解决了。
如果你读完了有点蒙,一头雾水,那不妨试试:
(1)因为语言缘故看不懂就找百度翻译;
(2)顺着报错提示走:
一般一长串报错都是因为报错的函数涉及多个脚本和模块,原则上要从第一条读到最后一条。但面对实际情况,我们可以从最后一条报错读起。最后一条报错一般都指向我们自己写的脚本,就是报错的最末端体现。大多数时候,阅读这条信息可以帮助我们快速解决问题。
(3)如果这个错误类型很普遍,上百度或者CSDN搜一搜;
(比如这个报错就是典型的AttributeError,在使用官方库的时候遇到这种报错,主要是因为不小心记错了函数名,或者是不小心对应错了函数和模块;模块本身有问题基本上都是小概率事件。)
(4)最后估计耗时太长,只依靠自己实在是解决不了问题了,那就拿出来问问吧。