Beginner coder here
I am trying to create multiple dataframes from multiple excel sheets in a single notebook with dataframe names being same as sheet names but I am unable to do so.
I have tried this but to no avail. Kindly help me on this.
file_name='file.xlsx'
xl = pd.ExcelFile(file_name)
dfs = {sh:xl.parse(sh) for sh in xl.sheet_names}
for key in dfs.keys():
dfs[key] = pd.DataFrame()
Expected Result is
excelbook contains sheet1 sheet2
I need to create two dataframes: sheet1 and sheet2
containing all the columns of sheet1 and sheet2
result that I am getting is I am able to create dictionary having all the dataframe as key and their columns as values but I need them all seperately out of the dictionary. as
dfs[sheet1]
dfs[sheet2]
i created a loop like this
for key in dfs.keys():
dfs[key] = pd.DataFrame()
but it is creating dataframe for the first key value pair only. df_sheet1 Kindly help me on this.