我正在从 Excel 文件读取数据,在将 Excel 数据解析到数据流中时,出现此属性错误。
构建数据框以便获取数据。我缺少什么? 读取和解析的行是:
xl=pd.read_excel('data_file.xlsx') #Read from excel file
dfs=xl.parse(xl.sheet_names[0]) #Parsing the excel into data stream
我得到的错误是:
File "C:\Users\Meghna\Anaconda3\lib\site-packages\pandas\core\generic.py", line 4376, in __getattr__ return object.__getattribute__(self, name)
AttributeError: 'DataFrame' object has no attribute 'parse'
最佳答案
你很困惑pd.read_excel
与 pd.ExcelFile
:
xl = pd.ExcelFile("data_file.xlsx")
sheets = dict()
for sheet_name in xl.sheet_names:
sheets[sheet_name] = xl.parse(sheet_name)
关于python - 属性错误: 'DataFrame' object has no attribute 'parse' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56492872/