i would like to save a different dataframe in different excel pages withb a simpler loop. How can i construct correctly this loop?
my Currently codes are:
for fund in list(read_ex.keys()):
writer = pd.ExcelWriter(excel_file, engine='xlsxwriter')
data_2 .to_excel(writer, sheet_name= 'Df_ag')
read_ex[fund] .to_excel(writer, sheet_name= fund[:28])
writer.save()
but the returns are only two page: the data_2 and the last in the loop. Thank you for your time
Imopla
For future readers:
I have been resolved this quastion in this way:
writer = pd.ExcelWriter(excel_file, engine='xlsxwriter')
data_2 .to_excel(writer, sheet_name= 'Df_ag')
for fund in list(read_ex.keys()):
read_ex[fund] .to_excel(writer, sheet_name= fund[:28])
writer.save()
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.