Hello everyone,
Iβm having trouble reading a simple file with CSV.read.
I have the following data:
1.0 2.462558e-04 11 -1.18791031e-04 +1.18791031e-04 +8.96777973e+02 +3.88470836e+02
1.0 2.462558e-04 12 +1.18790872e-04 -1.18790872e-04 -8.96777979e+02 -3.88470836e+02
1.0 2.462558e-04 21 +1.18790871e-04 -1.18790871e-04 +8.40080497e+02 +3.20800442e+02
1.0 2.462558e-04 22 -1.18791028e-04 +1.18791028e-04 -8.40080491e+02 -3.20800447e+02
which I put in a file test.dat
when I run
CSV.read("test.dat" ; datarow=1, delim=' ')
I get
ERROR: ArgumentError: data row (1) must come after header row (1)
Stacktrace:
[1] #Source#12(::String, ::CSV.Options, ::Int64, ::Int64, ::Array{DataType,1}, ::Bool, ::Bool, ::Int64, ::Int64, ::Int64, ::Bool, ::Type{T} where T) at /home/omerchiers/.julia/v0.6/CSV/src/Source.jl:49
[2] (::Core.#kw#Type)(::Array{Any,1}, ::Type{CSV.Source}) at ./<missing>:0
[3] #Source#11(::Char, ::UInt8, ::UInt8, ::String, ::Int64, ::Int64, ::Array{DataType,1}, ::Bool, ::Bool, ::DateFormat{Symbol("yyyy-mm-dd"),Tuple{Base.Dates.DatePart{'y'},Base.Dates.Delim{Char,1},Base.Dates.DatePart{'m'},Base.Dates.Delim{Char,1},Base.Dates.DatePart{'d'}}}, ::Int64, ::Int64, ::Int64, ::Bool, ::Type{T} where T, ::String) at /home/omerchiers/.julia/v0.6/CSV/src/Source.jl:25
[4] (::Core.#kw#Type)(::Array{Any,1}, ::Type{CSV.Source}, ::String) at ./<missing>:0
[5] #read#29(::Bool, ::Dict{Int64,Function}, ::Array{Any,1}, ::Function, ::String, ::Type{T} where T) at /home/omerchiers/.julia/v0.6/CSV/src/Source.jl:294
[6] (::CSV.#kw##read)(::Array{Any,1}, ::CSV.#read, ::String, ::Type{T} where T) at ./<missing>:0 (repeats 2 times)
If instead I change the file to
# Nothing here
1.0 2.462558e-04 11 -1.18791031e-04 +1.18791031e-04 +8.96777973e+02 +3.88470836e+02
1.0 2.462558e-04 12 +1.18790872e-04 -1.18790872e-04 -8.96777979e+02 -3.88470836e+02
1.0 2.462558e-04 21 +1.18790871e-04 -1.18790871e-04 +8.40080497e+02 +3.20800442e+02
1.0 2.462558e-04 22 -1.18791028e-04 +1.18791028e-04 -8.40080491e+02 -3.20800447e+02
And type in the repl
CSV.read("test.dat" ; datarow = 2, delim=' ')
I get:
4Γ2 DataFrames.DataFrame
β Row β #Nothing β here β
βββββββΌββββββββββββββΌβββββββββββββββ€
β 1 β 1.0 β 0.000246256 β
β 2 β 11.0 β -0.000118791 β
β 3 β 0.000118791 β 896.778 β
β 4 β 388.471 β 1.0 β
Neither of which is what I want obviously.
Iβm on julia v0.6.2
CSV 0.1.5
DataFrames 0.10.1
As a side note, I did Pkg.update(), but somehow the system does not update to DataFrames 0.11
Many thanks in advance,
Olivier