November 2017
Beginner
316 pages
6h 40m
English
Let's say we have a CSV file by the name sample.csv and we want to read its content. This is how we do it in Julia:
julia> csvfile = readcsv("sample.csv")
5×3 Array{Any,2}:
1 "James" "UK"
2 "Lora" "UK"
3 "Raj" "India"
4 "Rangnatham" "Sri lanka"
5 "Azhar" "Bangladesh"
So using readcsv, we have converted the CSV file into an array of 5x3 matrix which can now be manipulated using the various array operations, as shown in the following example:
# getting only the names of the people julia> csvfile[:,2] 5-element Array{Any,1}: "James" "Lora" "Raj" "Rangnatham" "Azhar" # getting only the top 3 data julia> csvfile[1:3,:] 3×3 Array{Any,2}: 1 "James" "UK" 2 "Lora" "UK" 3 "Raj" "India" # reverse sorting the ...Read now
Unlock full access