[英]df.to_csv saving 03 as 3 in csv
sample file:示例文件:
03|02|2|02|F|3|47|P| |AG|AFL|24|20201016| 1 |West |CH|India - LA |CNDO
code:代码:
df1 = pd.read_csv("GM3.txt",sep="|",dtype=object)
df1.to_csv('file_validation.csv',index=None)
output in csv: csv 中的 output:
3 2 2 2 F 3 47 P AG AFL 24 20201016 1 West CH India - LA CNDO 302
when I am trying to print df1.to_csv() it is giving me below output: 0 03 02 2 CH India - LA CNDO当我尝试打印 df1.to_csv() 时,它在 output: 0 03 02 2 CH India - LA CNDO 下面给了我
I want csv to be stored as string format ie 03,02 instead of integer.我希望将 csv 存储为字符串格式,即 03,02 而不是 integer。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.