Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
157 views
in Technique[技术] by (71.8m points)

python - File unavailable when adding Pandas write mode is append

Data_Frame = pd.DataFrame(values)
with pd.ExcelWriter("sam.xlsx", mode='a', engine='openpyxl') as writer:
    Data_Frame.to_excel(writer, header=False, index=False)

This is part of my code. After writing and executing the code, the file becomes unusable. (There's a message like "There is a problem with the content of 'sam.xlsx'")

Also remove ExcelWriter mode, like this <with pd.ExcelWriter("sam.xlsx", engine='openpyxl') as writer:> and the excel file opens properly without error.

What's wrong with this? I can't even find it on Google.

Please help me.......

question from:https://stackoverflow.com/questions/65830380/file-unavailable-when-adding-pandas-write-mode-is-append

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...