Python中pandas錯誤
從 YTYZX有图有真相的百科
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