# How to read specific columns of a csv file

**URL:** <https://discourse.julialang.org/t/how-to-read-specific-columns-of-a-csv-file/86644>\
**Category:** New to Julia\
**Tags:** question\
**Created:** [September 1, 2022, 2:34pm UTC](https://discourse.julialang.org/t/how-to-read-specific-columns-of-a-csv-file/86644 "2022-09-01T14:34:26Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![sbacelar](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sbacelar/32/4359_2.png) [@sbacelar](https://discourse.julialang.org/u/sbacelar)\
**Post date:** [September 1, 2022, 2:34pm UTC](https://discourse.julialang.org/t/how-to-read-specific-columns-of-a-csv-file/86644/1 "2022-09-01T14:34:26Z")

</div>

I am trying to read the first column of “test.csv” file using `CSV.jl`. I don’t understand why this doesn’t work:  
`test.csv` is:  
a;b;c  
1;2;3  
4;5;6  
9;8;7

```julia
using CSV
y_train = CSV.File("test.csv"; select=[:, 1])

```

Is it possible doing the same using `CSV.Read`?

---

<div class="post-metadata">

**Author:** ![oheil](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oheil/32/220745_2.png) [@oheil](https://discourse.julialang.org/u/oheil)\
**Post date:** [September 1, 2022, 2:42pm UTC](https://discourse.julialang.org/t/how-to-read-specific-columns-of-a-csv-file/86644/2 "2022-09-01T14:42:22Z")

</div>

In your case it’s either

```julia
y_train = CSV.File("test.csv"; select=[1])

```

or

```julia
y_train = CSV.File("test.csv"; select=[:a])

```

see [Examples · CSV.jl](https://csv.juliadata.org/stable/examples.html#select_example)
