How to convert a csv column into a vector

How to convert the first column of “test.csv” file into a vector (array)?
test.csv is:
a;b;c
1;2;3
4;5;6
9;8;7

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

I want test to be a vector.

a = CSV.File("test.csv"; select=[1]).a
4 Likes

Another option is:

julia> a = CSV.read("test.csv", values; select = [1]) |> only
3-element Vector{Int64}:
 1
 4
 9
1 Like

Here I have to know the name of the selected column (“a”).

You could do:

using Tables
first_col = Tables.getcolumn(CSV.File("test.csv"; select=[1]), 1)
2 Likes