# String7 type with read CSV?

**URL:** <https://discourse.julialang.org/t/string7-type-with-read-csv/100741>\
**Category:** New to Julia\
**Created:** [June 23, 2023, 2:11pm UTC](https://discourse.julialang.org/t/string7-type-with-read-csv/100741 "2023-06-23T14:11:49Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Axze-rgb](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/axze-rgb/32/50986_2.png) [@Axze-rgb](https://discourse.julialang.org/u/Axze-rgb)\
**Post date:** [June 23, 2023, 2:11pm UTC](https://discourse.julialang.org/t/string7-type-with-read-csv/100741/1 "2023-06-23T14:11:49Z")

</div>

Hello,

I am trying to import a single column file (very long more than 1 million lines). They are real number, so I thing float64 (numbers like 17, 139.4, 2345.87)

Here is the code

> df=CSV.read(“QD.csv”, DataFrame; header = false)  
> rename!(df,[:Column1] .=\> [:QUAL])

But now I just tried

> first(df, 10)

and I get something strange

10×1 DataFrame

> | Row | Column1 |
> | --- | --- |
> | | String7 |
> | 1 | 21.54 |
> | 2 | 33.09 |
> | 3 | 33.09 |
> | 4 | 2.66 |
> | 5 | 1.43 |
> | 6 | 0.77 |
> | 7 | 2.93 |
> | 8 | 1.59 |
> | 9 | 1.34 |
> | 10 | 1.3 |

What is that “String 7”? Why didn’t it recognise the numbers as float, and what is String 7?

And how would I change this to float64?  
Thanks a lot

I am a newbie here, sorry if this is an obvious question

EDIT: I tried this

> ArgumentError: cannot parse String7(“.”) as Float64

but got

ArgumentError: cannot parse String7(“.”) as Float64

---

<div class="post-metadata">

**Author:** ![Oscar\_Smith](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oscar_smith/32/25343_2.png) [@Oscar\_Smith](https://discourse.julialang.org/u/Oscar_Smith)\
**Post date:** [June 23, 2023, 2:15pm UTC](https://discourse.julialang.org/t/string7-type-with-read-csv/100741/2 "2023-06-23T14:15:55Z")

</div>

So the problem is that (for some reason) in one of your rows, rather than a number, there’s a singular `.` with no digits. This isn’t convertible to a `Float64`.

---

<div class="post-metadata">

**Author:** ![Axze-rgb](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/axze-rgb/32/50986_2.png) [@Axze-rgb](https://discourse.julialang.org/u/Axze-rgb)\
**Post date:** [June 23, 2023, 2:18pm UTC](https://discourse.julialang.org/t/string7-type-with-read-csv/100741/3 "2023-06-23T14:18:10Z")

</div>

Ok, so the problem is the input file. Ok thanks a lot 🙂 I am gonna investigate this.

---

<div class="post-metadata">

**Author:** ![tbeason](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tbeason/32/15898_2.png) [@tbeason](https://discourse.julialang.org/u/tbeason)\
**Post date:** [June 23, 2023, 2:20pm UTC](https://discourse.julialang.org/t/string7-type-with-read-csv/100741/4 "2023-06-23T14:20:51Z")

</div>

If the `"."` is meant to represent `missing`, you can tell that to `CSV.read` – I think the keyword argument is `missingstrings` or something close to that

---

<div class="post-metadata">

**Author:** ![Axze-rgb](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/axze-rgb/32/50986_2.png) [@Axze-rgb](https://discourse.julialang.org/u/Axze-rgb)\
**Post date:** [June 23, 2023, 2:22pm UTC](https://discourse.julialang.org/t/string7-type-with-read-csv/100741/5 "2023-06-23T14:22:30Z")

</div>

Actually, there is no missing data, and I also checked for a line where I would only have a singuler `.`

but

> awk ‘/^.$/’ QUAL.csv

returns nothing. Is it possible this is introduced when reading the file? I am really confused

---

<div class="post-metadata">

**Author:** ![Henrique\_Becker](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/henrique_becker/32/15443_2.png) [@Henrique\_Becker](https://discourse.julialang.org/u/Henrique_Becker)\
**Post date:** [June 23, 2023, 2:23pm UTC](https://discourse.julialang.org/t/string7-type-with-read-csv/100741/6 "2023-06-23T14:23:57Z")

</div>

Can the point not be really alone but have whitespace around it?

---

<div class="post-metadata">

**Author:** ![Axze-rgb](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/axze-rgb/32/50986_2.png) [@Axze-rgb](https://discourse.julialang.org/u/Axze-rgb)\
**Post date:** [June 23, 2023, 2:31pm UTC](https://discourse.julialang.org/t/string7-type-with-read-csv/100741/7 "2023-06-23T14:31:24Z")

</div>

This is a possibility. The file is an extract from a very complicated kind of bioinformatics file format, and it’s very possible something weird / unexpected happened. But what matters here, is that I know the problem seems not my Julia code, but a problem upstream. Thank you 🙂 I will investigate.

EDIT: indeed, there is a whitespace somewhere that shouldn’t be there. Thanks a lot 🙂

---

<div class="post-metadata">

**Author:** ![AMJ](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/amj/32/214096_2.png) [@AMJ](https://discourse.julialang.org/u/AMJ)\
**Post date:** [June 23, 2023, 2:48pm UTC](https://discourse.julialang.org/t/string7-type-with-read-csv/100741/8 "2023-06-23T14:48:20Z")

</div>

For more information on `String7`, it is a type from [InlineStrings.jl](https://github.com/JuliaStrings/InlineStrings.jl) package which is used for working with strings where it helps with allocation and performance.

---

<div class="post-metadata">

**Author:** ![Axze-rgb](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/axze-rgb/32/50986_2.png) [@Axze-rgb](https://discourse.julialang.org/u/Axze-rgb)\
**Post date:** [June 23, 2023, 3:02pm UTC](https://discourse.julialang.org/t/string7-type-with-read-csv/100741/9 "2023-06-23T15:02:48Z")

</div>

Thanks, bookmarked 🙂

I would like to thank you all for your friendly welcome.
