python - Pandas Dataframe to_csv format output -
I can not find a way to control the output of each column dataframe. From the following code:
df.to_csv ('dfnc.txt' September = '', float_format = '% 8F', column = ['cycle', 'passs',' ip ',' country ',' Latitude '], index = false)
I am getting this:
1.00000000 1.00000000 543.00000000 23.15881870 -64.7,04,85 , 9 50 1.00000000 1.00000000 544.00000000 23.10356160 -64.64569150 1.00000000 545.00000000 23.04852510 -64.58650550 1.00000000 1.00000000 546.00000000 22.99370760 -64.52730150 1.00000000 1.00000000 547.00000000 22.93910770 -64.46807990 and I think it should: 1 1 543 23.15881870 -64,70485950 1 1 544 23,10356160 -64,64569150 1 1 545 23,04852510 -64,58650550 1 1 546 22,99370760 -64,52730150 1 1 547 22,93910770-64,46807990
Help Thanks so much for
After
I think that you just have 3 columns
1 for You can change from int64
before writing the CSV file (if you check the .types
, I'm sure they're all float64
):
df [['cycle', 'passs', 'ip']] = df [['cycle', 'pass', 'ip']]. Astype (int64)
Comments
Post a Comment