更改

跳转至: 导航搜索

Python中pandas错误

添加617字节, 2022年3月8日 (二) 19:19
python pandas错误
import pandas as pd
import os

datalist = []
for fname in os.listdir('.'):
if fname.startwith('new') and fname.endwith('xlsx')
datalist.apped(pd.read_excel(fname))


在运行之后发现报错:

Traceback (most recent call last):
File ".", line 6, in <module>
datalist.apped(pd.read_excel(fname))
AttributeError: module 'pandas' has no attribute 'read_excel'

因为是在此文件夹下有一个名字叫pandas的python文件,修改文件名为pandas1.py后即可正常运行。
请勿把文件名定义为与import的包名字相同,可在后面任意加上数字等。比如pandas1.py
匿名用户

导航菜单