# New behaviour due to an update of the package CSV when using CSV.write

**URL:** <https://discourse.julialang.org/t/new-behaviour-due-to-an-update-of-the-package-csv-when-using-csv-write/26442>\
**Category:** Performance\
**Tags:** question\
**Created:** [July 16, 2019, 8:58pm UTC](https://discourse.julialang.org/t/new-behaviour-due-to-an-update-of-the-package-csv-when-using-csv-write/26442 "2019-07-16T20:58:08Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![steph\_de\_paris](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/steph_de_paris/32/7780_2.png) [@steph\_de\_paris](https://discourse.julialang.org/u/steph_de_paris)\
**Post date:** [July 16, 2019, 8:58pm UTC](https://discourse.julialang.org/t/new-behaviour-due-to-an-update-of-the-package-csv-when-using-csv-write/26442/1 "2019-07-16T20:58:08Z")

</div>

Hello,

When I use the code

```julia
using CSV
using DataFrames
rm("tmp.csv",force=true)
df=DataFrame([Float64 for k in 1:1],[Symbol("ps_prev_$k") for k in 1:1],0);
push!(df,1000.0)
CSV.write("tmp.csv",df,delim=';', append=true, writeheader=false);

```

on JuliaBox, the file tmp.csv contains 1000.0 which is what I want.

Nevertheless, on my Linux distribution, the file tmp.csv contains 1e3 which is NOT what I would like for this csv output. Before the updating of the CSV and DataFrames packages, the behaviour was as on JuliaBox.

Is-it due to the new version of the CSV package ? If it is the case, could you tell me how to recover 1000.0 instead of 1e3 in the tmp.csv file by using the previous code ? Thanks very much !

NB:

The version of the CSV package is:  
CSV v0.4.3 on JuliaBox ;  
CSV v0.5.9 on my Linux distribution.

The version of the DataFrames package is:  
DataFranes v0.17.1 on JuliaBox ;  
DataFrames v0.19.0 on my Linux distribution.

---

<div class="post-metadata">

**Author:** ![jling](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jling/32/212909_2.png) [@jling](https://discourse.julialang.org/u/jling)\
**Post date:** [July 16, 2019, 9:12pm UTC](https://discourse.julialang.org/t/new-behaviour-due-to-an-update-of-the-package-csv-when-using-csv-write/26442/2 "2019-07-16T21:12:56Z")

</div>

I find some expression here very hacky, e.g:

```julia
[Float64 for k in 1:1]
push!(df,1000.0)

```

what is the goal here?

---

<div class="post-metadata">

**Author:** ![steph\_de\_paris](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/steph_de_paris/32/7780_2.png) [@steph\_de\_paris](https://discourse.julialang.org/u/steph_de_paris)\
**Post date:** [July 16, 2019, 9:22pm UTC](https://discourse.julialang.org/t/new-behaviour-due-to-an-update-of-the-package-csv-when-using-csv-write/26442/3 "2019-07-16T21:22:01Z")

</div>

This code comes from a more complexe code. This part of the code is OK.

The goal here is just to put the float 1000.0 in the DataFrame df. My problem is just with the CSV output and thus with the new CSV.write function (because of the updating of the CSV package ?), not with the DataFrame in my opinion.

---

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [July 17, 2019, 6:04am UTC](https://discourse.julialang.org/t/new-behaviour-due-to-an-update-of-the-package-csv-when-using-csv-write/26442/4 "2019-07-17T06:04:46Z")

</div>

As a workaround, you can [`add`](https://julialang.github.io/Pkg.jl/v1/managing-packages/#Adding-packages-1) a specific version of CSV for both manifests, and perhaps [`pin`](https://julialang.github.io/Pkg.jl/v1/managing-packages/#Pinning-a-package-1) it so it is not updated accidentally.

Cf the discussion at

> [@CSV ruins scientific notation](https://discourse.julialang.org/t/csv-ruins-scientific-notation/25835):
>
> I think it’s a bug in CSV but I’m not 100% sure that’s why I ask here first: I wrote some code to convert a txt file into a csv file (basically adding a header and commata). My code: fname = input\_name = split(split(txt\_file,"/")[end], ".")[1] header = ["x","y","z","d"] df = CSV.read(txt\_file, delim=" ", header=header) println(df) CSV.write("../inputs/csv/"\*fname\*".csv", df) The txt file: 1234.56789 4232.45455455 -8789.5455 1.0121325235677855e-11 The print out: fname: test\_123 1×4 Data…

I could not find an open issue at CSV.jl, which would be the first step towards changing this (or allowing it to be customized).

---

<div class="post-metadata">

**Author:** ![steph\_de\_paris](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/steph_de_paris/32/7780_2.png) [@steph\_de\_paris](https://discourse.julialang.org/u/steph_de_paris)\
**Post date:** [July 17, 2019, 12:34pm UTC](https://discourse.julialang.org/t/new-behaviour-due-to-an-update-of-the-package-csv-when-using-csv-write/26442/5 "2019-07-17T12:34:28Z")

</div>

Thanks for this info… Could you tell me how I can come back to CSV v0.4.3 knowing that I have updated to CSV v0.5.9 ?

Could you also tell me how we can block an updating to avoid some regression as much as we can (ie before having validated a new package with non-regression tests) ?

Thanks very much !

---

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [July 17, 2019, 12:42pm UTC](https://discourse.julialang.org/t/new-behaviour-due-to-an-update-of-the-package-csv-when-using-csv-write/26442/6 "2019-07-17T12:42:48Z")

</div>

These are precisely the two things I linked above.

---

<div class="post-metadata">

**Author:** ![steph\_de\_paris](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/steph_de_paris/32/7780_2.png) [@steph\_de\_paris](https://discourse.julialang.org/u/steph_de_paris)\
**Post date:** [July 17, 2019, 12:44pm UTC](https://discourse.julialang.org/t/new-behaviour-due-to-an-update-of-the-package-csv-when-using-csv-write/26442/7 "2019-07-17T12:44:27Z")

</div>

Oups … sorry … . It is the morning … . I did not see the hyperlink add and pin. I will try this afternoon.

---

<div class="post-metadata">

**Author:** ![steph\_de\_paris](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/steph_de_paris/32/7780_2.png) [@steph\_de\_paris](https://discourse.julialang.org/u/steph_de_paris)\
**Post date:** [July 17, 2019, 1:02pm UTC](https://discourse.julialang.org/t/new-behaviour-due-to-an-update-of-the-package-csv-when-using-csv-write/26442/8 "2019-07-17T13:02:29Z")

</div>

I found this basic solution for my problem (but not really “smart”):

```julia
using CSV
using DataFrames
rm("tmp2.csv",force=true)
df2=DataFrame([String for k in 1:1],[Symbol("ps_prev_$k") for k in 1:1],0);
x=1000.0;
pop=[string(x)]
push!(df2,pop)
CSV.write("tmp2.csv",df2,delim=';', append=true, writeheader=false);

```

This also works for the case indicated in [CSV ruins scientific notation](https://discourse.julialang.org/t/csv-ruins-scientific-notation/25835) (identical behaviour and result OK by changing the value of x above)
