简体   繁体   中英

Preserve leading zeros using pandas to_csv

I have a pandas DataFrame containing leading zeros. I want to export it to CSV, but the to_csv() method removes leading zeros from the numbers. How can I preserve them?

不确定您的代码究竟发生了什么,但最好替换 NaN,然后​​查看 0 在您的情况下是否表示 NaN。

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