文章詳情頁
Python使用Excel將數(shù)據(jù)寫入多個(gè)sheet
瀏覽:4日期:2022-07-25 13:57:01
將一個(gè)列表數(shù)據(jù)寫入output.xlsx的a,b,c……等sheet中
import pandas as pddf1 = pd.DataFrame({’a’:[3,1],’b’:[4,3]}) df2 = df1.copy()with pd.ExcelWriter(’F:python入門數(shù)據(jù)2output.xlsx’) as writer: str1 = [’a’,’b’,’c’,’d’,’e’,’f’,’g’,’h’,’i’, ’j’,’k’,’l’,’m’,’n’,’o’,’p’,’q’] for i in str1: name = str(i) df1.to_excel(writer, sheet_name= name)writer.save()writer.close()
結(jié)果
此時(shí)每個(gè)sheet的內(nèi)容都是一樣的。
以上就是本文的全部內(nèi)容,希望對大家的學(xué)習(xí)有所幫助,也希望大家多多支持好吧啦網(wǎng)。
標(biāo)簽:
python
相關(guān)文章:
1. vue實(shí)現(xiàn)web在線聊天功能2. SpringBoot+TestNG單元測試的實(shí)現(xiàn)3. Springboot 全局日期格式化處理的實(shí)現(xiàn)4. idea配置jdk的操作方法5. Docker容器如何更新打包并上傳到阿里云6. Java GZip 基于內(nèi)存實(shí)現(xiàn)壓縮和解壓的方法7. 完美解決vue 中多個(gè)echarts圖表自適應(yīng)的問題8. VMware中如何安裝Ubuntu9. python 浮點(diǎn)數(shù)四舍五入需要注意的地方10. JAMon(Java Application Monitor)備忘記
排行榜
