How to read specific columns of a csv file

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

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

Is it possible doing the same using CSV.Read?

In your case it’s either

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

or

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

see Examples · CSV.jl

3 Likes