CSV.jl icon indicating copy to clipboard operation
CSV.jl copied to clipboard

CSV.write - floats

Open bkamins opened this issue 6 years ago • 4 comments

When outputting floats when writing a CSV file it would be nice to allow users to control what kind of notation should be used (maybe allow to pass a formatter). The issue is that:

  1. sometimes you are OK with the default
  2. sometimes you may want to enforce scientific notation
  3. sometimes you might want to enforce rounding (this is needed when later you want to read in the file using other software that does not accept that many decimal digits as are normally printed by Julia - what I mean is that eg. 3.141592653589793 is parsed incorrectly by some readers and you need to round it to e.g. 8 decimal digits)

This is a minor issue.

bkamins avatar Sep 05 '19 09:09 bkamins

Marking as 1.X milestone, meaning I don't plan on implementing this before 1.0 release (which will happen soon). I was originally hoping https://github.com/JuliaLang/julia/pull/32859 would land in a reasonable amount of time, but alas, it has fallen by the wayside of paltry review. My next solution is to just put the functionality in a package and we can use it here.

quinnj avatar Jun 26 '20 04:06 quinnj

@quinnj any update on this feature? We are working on a project where we need to export the floating point numbers without scientific notation. Any option to save all floating point numbers with a fixed number of decimals?

juliohm avatar Mar 29 '23 12:03 juliohm

No update as of yet, but I'm hoping to have time to address this soon as we do a blitz on CSV open issues.

quinnj avatar Mar 31 '23 03:03 quinnj

I agree with @bkamins. Would be great if this could be fixed. A single notation makes it easier to share data with people using other programming languages.

jkoefinger avatar Apr 26 '23 14:04 jkoefinger