pandas create separate dataframe for each excel sheet

你。 提交于 2021-01-29 10:52:30

问题


I have an excel file with about 20 sheets. Each sheets contain different type of data I would like to loop the excel and create a data frame for each of these sheets with data frame name equal to the sheet name.

Tried different solution without success


回答1:


You can create dictionary of DataFrames by parameter sheet_name=None in read_excel:

dfs = pd.read_excel(fileName, sheet_name=None)

print (dfs['sheetname1'])
print (dfs['sheetname2'])


来源:https://stackoverflow.com/questions/52538718/pandas-create-separate-dataframe-for-each-excel-sheet

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!