Getting Started

Getting Started

uCSV.read

uCSV.read enables you to construct complex parsing-rules through a compact and flexible API that aims to handle everything from the simplist base-case to the nightmarish.

By default, it assumes that you're starting with a simple comma-delimited data matrix. This makes uCSV.read a suitable tool for reading raw numeric datasets for conversion to 2-D Arrays, in addition to reading more complex datasets

julia> using uCSV

julia> s =
       """
       1.0,1.0,1.0
       2.0,2.0,2.0
       3.0,3.0,3.0
       """;

julia> data, header = uCSV.read(IOBuffer(s));

julia> data
3-element Array{Any,1}:
 [1.0, 2.0, 3.0]
 [1.0, 2.0, 3.0]
 [1.0, 2.0, 3.0]

julia> header
0-element Array{String,1}

julia> uCSV.tomatrix(uCSV.read(IOBuffer(s)))
3×3 Array{Float64,2}:
 1.0  1.0  1.0
 2.0  2.0  2.0
 3.0  3.0  3.0

julia> uCSV.tovector(uCSV.read(IOBuffer(s)))
9-element Array{Float64,1}:
 1.0
 2.0
 3.0
 1.0
 2.0
 3.0
 1.0
 2.0
 3.0

Some examples of what uCSV.read can handle:

uCSV.read will only try and parse your data into Ints, Float64s, or Strings, by default.