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

**URL:** https://discourse.julialang.org/t/new-behaviour-due-to-an-update-of-the-package-csv-when-using-csv-read/26565
**Category:** General Usage
**Created:** [July 19, 2019, 10:20pm UTC](https://discourse.julialang.org/t/new-behaviour-due-to-an-update-of-the-package-csv-when-using-csv-read/26565 "2019-07-19T22:20:17Z")
**Posts on this page:** 6
**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 19, 2019, 10:20pm UTC](https://discourse.julialang.org/t/new-behaviour-due-to-an-update-of-the-package-csv-when-using-csv-read/26565/1 "2019-07-19T22:20:17Z")

</div>

Hello,

When the file tmp.csv just contains the string “INFI\_”, the code

```julia
using CSV
data = CSV.read("tmp.csv",header=false,delim=';');
data

```

gives the result

1×1 DataFrames.DataFrame  
│ Row │ Column1 │  
│ │ String │  
├─────┼─────────┤  
│ 1 │ INFI\_ │

which is what I want.

BUT, when the file tmp.csv just contains the strings “INFI”, the code gives the result

1×1 DataFrames.DataFrame  
Row │ Column1 │  
│ Float64 │  
├─────┼─────────┤  
│ 1 │ Inf │

That is to say, there is a cast from a string to a float. Thus, INFI seems to be a reserved words. I have the same behaviour by replacing “INFI” with “INF”.

Is there a simple solution to avoid this behaviour ie to keep “INFI” as a string ? Thanks very much.

NB : Note that this new behaviour is obtained with the version CSV v0.5.9 of the CSV package.  
With the version CSV v0.4.3 of the CSV package, I do not have this problem.

---

<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 20, 2019, 5:24am UTC](https://discourse.julialang.org/t/new-behaviour-due-to-an-update-of-the-package-csv-when-using-csv-read/26565/2 "2019-07-20T05:24:21Z")

</div>

> [@steph\_de\_paris](#):
>
> That is to say, there is a cast from a string to a float. Thus, INFI seems to be a reserved words.

I would check if there is an existing issue for CSV.jl, and if not, open one. This looks like a bug.

---

<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 20, 2019, 3:11pm UTC](https://discourse.julialang.org/t/new-behaviour-due-to-an-update-of-the-package-csv-when-using-csv-read/26565/3 "2019-07-20T15:11:51Z")

</div>

Thanks very much, Tamas ! This issue seems to have similarities to the one described in [New behaviour due to an update of the package CSV when using CSV.write - #7 by steph\_de\_paris](https://discourse.julialang.org/t/new-behaviour-due-to-an-update-of-the-package-csv-when-using-csv-write/26442/7)

If there is no solution, is there another package to read a CSV file with Julia ? (except the one to come back to the CSV v0.4.3 version of the CSV package)

---

<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 20, 2019, 3:15pm UTC](https://discourse.julialang.org/t/new-behaviour-due-to-an-update-of-the-package-csv-when-using-csv-read/26565/4 "2019-07-20T15:15:50Z")

</div>

There is

> [@\[ANN\] TableReader.jl - A fast and simple CSV parser](https://discourse.julialang.org/t/ann-tablereader-jl-a-fast-and-simple-csv-parser/22335):
>
> I’m excited to announce that my new package, [TableReader.jl](https://github.com/bicycle1885/TableReader.jl), is registered as an official package. You can now install it by add TableReader in the package management mode of REPL. As the title says, this is a new CSV parser written for Julians. The expected response is “Why yet another? We already have several packages to read CSV!”. Yes, you are absolutely right. We already have CSV.jl, CSVFiles.jl, CSVReader.jl, TextParse.jl, and more. But please give me a moment to explain the motivation of…

---

<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 20, 2019, 3:26pm UTC](https://discourse.julialang.org/t/new-behaviour-due-to-an-update-of-the-package-csv-when-using-csv-read/26565/5 "2019-07-20T15:26:15Z")

</div>

OK, thanks again ! By the way, perhaps a solution for my issue could be

`CSV.read(file; types=[String])`

PS : I cannot test this on my Linux OS because of the restricted access from my home (this is the weekend …).

---

<div class="post-metadata">

### Author: ![quinnj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/quinnj/32/11_2.png) [@quinnj](https://discourse.julialang.org/u/quinnj)
#### Post date: [July 21, 2019, 7:49am UTC](https://discourse.julialang.org/t/new-behaviour-due-to-an-update-of-the-package-csv-when-using-csv-read/26565/6 "2019-07-21T07:49:51Z")

</div>

Yes, you can always manually specify what the type of a column should be, so doing `types=[String]`, or w/ a Dict by column id or number: `types=Dict(1=>String)`.

What’s going on here is that the Parsers.jl package parses both `INF` and `INFINITY` as valid `Float64` values, and it looks like it considers any prefix in-between as valid as well, so this can ultimately be fixed in Parsers.jl itself.
