Im trying to save the excel file generated in two different folders (output1, output2)
I tried this and didnt worked
writer = pd.ExcelWriter([output1,output2], engine='xlsxwriter')
df1.to_excel(writer, sheet_name='sheeta', index = None)
Thanks
You can copy the file using How do I copy a file in Python? after you created it once ... or simply write it twice:
import pandas as pd
output1 = "p.xlsx"
output2 = "q.xlsx"
df = pd.DataFrame({'Data': [10, 20, 30, 20, 15, 30, 45]})
for o in [output1,output2]:
writer = pd.ExcelWriter(o, engine='xlsxwriter')
df.to_excel(writer, sheet_name='Sheet1')
writer.save()
Results in 2 files being written, containing the data:
Doku:
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.