python pandas csv导出
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/14217581/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
python pandas csv exporting
提问by Manuel Zompetta
I've problem exporting a dataframe to CSV file.
我在将数据框导出到 CSV 文件时遇到问题。
Data types are String and Float64 values like this:
数据类型是 String 和 Float64 值,如下所示:
In [19]: segmenti_t0
Out[19]:
SEGM1 SEGM2
AD P.S. 8.3
SCREMATO 0.6
CRE STD 1.2
FUN INTERO 0.0
P.S. 2.0
SCREMATO 0.0
NORM INTERO 13.1
P.S. 69.5
SCREMATO 5.2
Name: Quota volume_t0
I try to export this dataframe with this command:
我尝试使用以下命令导出此数据框:
IN [20]: segmenti_t0.to_csv('C:Users\MarioRossi\prova.csv', sep=";")
When I try to open it with Excel or I try to import it in excel from the csv file with formatting parameters I obtain really strange formatting for float values like 69.5000 or 5.2.0000000 or date times formatting too like this:
当我尝试用 Excel 打开它或者我尝试从带有格式参数的 csv 文件中将它导入到 Excel 中时,我获得了非常奇怪的浮点值格式,例如 69.5000 或 5.2.0000000 或日期时间格式,如下所示:
NORM INTERO 13.01
NORM P.S. 69.05.00
NORM SCREMATO 5.02
Consider that I m using European format ("," as decimal as I use to import the original raw data from csv files).
考虑到我使用的是欧洲格式(“,”作为十进制,因为我用来从 csv 文件导入原始原始数据)。
Please help me: I developed a software (with GUI and so on) and I cant deliver it for that reason!
请帮助我:我开发了一个软件(带有 GUI 等),因此我无法交付它!
Thanks
谢谢

