简体   繁体   中英

Pandas to_csv, file readable only with LibreOffice

I'm doing default Pandas read_excel, performing some actions on the dataframe, and at the end I'm saving the file:

df.to_csv(target, index=False, compression='gzip', sep='|')

although the file is readable only with LibreOffice Calc -UTF-8, USA. If file is opened with Excel then I can see the filename in the first row / first column, and bunch of diamons with question marks in the other fields. Tried to set encoding in 'to_csv' for 'utf-8', 'utf-8-sig', 'utf-16' but nothing seems to work. How to make this file readable in Excel also?

Thanks!

Compression was the issue here. Thanks!

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM