Readtimearray function in Julia TimeSeries package

I would like to read a csv file of the following kind with readtimearray:

"","ES1 Index","VG1 Index","TY1 Comdty","RX1 Comdty","GC1 Comdty"
"1999-01-04",1391.12,3034.53,66.515625,86.2,441.39
"1999-01-05",1404.86,3072.41,66.3125,86.17,440.63
"1999-01-06",1435.12,3156.59,66.4375,86.32,441.7
"1999-01-07",1432.32,3106.08,66.25,86.22,447.67
"1999-01-08",1443.81,3093.46,65.859375,86.36,447.06
"1999-01-11",1427.84,3005.07,65.71875,85.74,449.5
"1999-01-12",1402.33,2968.04,65.953125,86.31,442.92
"1999-01-13",1388.88,2871.23,66.21875,86.52,439.4
"1999-01-14",1366.46,2836.72,66.546875,86.73,440.01

      

However, this is what I get when I evaluate readtimearray ("myfile.csv")

ERROR: `convert` has no method matching convert(::Type{UTF8String}, ::Float64)
 in push! at array.jl:460
 in readtimearray at /home/juser/.julia/v0.3/TimeSeries/src/readwrite.jl:25

      

What can't I see?

+3


source to share


2 answers


This looks like a bug in readtimearray

. Blank lines are removed, but the code only looks at the first column to identify them. Since the header has an empty row in the first column, it is removed ...

Changing the header of your file to



"date","ES1 Index","VG1 Index","TY1 Comdty","RX1 Comdty","GC1 Comdty"

      

fixes the problem.

+5


source


You are using convert

which is for use with julia types (see doc for more information).

You are parsing the string with Date :



d=Date("1999-04-01","yyyy-mm-dd")
#...
array_of_dates = map(x->Date(x,"yyyy-mm-dd"),array_of_strings)

      

+2


source







All Articles