Open
Description
openedon Feb 12, 2019
I am trying to parse a simple CSV which looks like this:
"007018","99999","WXPOD 7018","","","","+00.000","+000.000","+7018.0","20110309","20130730"
"007026","99999","WXPOD 7026","AF","","","+00.000","+000.000","+7026.0","20120713","20170822"
"007070","99999","WXPOD 7070","AF","","","+00.000","+000.000","+7070.0","20140923","20150926"
"008260","99999","WXPOD8270","","","","+00.000","+000.000","+0000.0","19960101","20100731"
"008268","99999","WXPOD8278","AF","","","+32.950","+065.567","+1156.7","20100519","20120323"
"008307","99999","WXPOD 8318","AF","","","+00.000","+000.000","+8318.0","20100421","20100421"
"008411","99999","XM20","","","","","","","20160217","20160217"
"008414","99999","XM18","","","","","","","20160216","20160217"
"008415","99999","XM21","","","","","","","20160217","20160217"
"008418","99999","XM24","","","","","","","20160217","20160217"
and I am trying to parse the last two columns as dates (dateformat"yyyymmdd"
)
I believe this is the correct way to set up the colparser for the load:
loadtable(
"/Users/christopheralexander/Documents/testcsv.csv",
colparsers=Dict(10=> dateformat"yyyymmdd"),
colnames=["usaf", "wban", "name", "ccode", "state", "icao", "lat", "lon", "elev", "startdate", "enddate"],
header_exists=false, indexcols=[1, 2]
)
...however I am getting the following exception:
ERROR: MethodError: no method matching length(::TextParse.StrRange)
Closest candidates are:
length(::Core.SimpleVector) at essentials.jl:561
length(::Base.MethodList) at reflection.jl:801
length(::Core.MethodTable) at reflection.jl:875
...
_similar_for(::UnitRange{Int64}, ::Type{Any}, ::TextParse.StrRange, ::Base.HasLength) at ./array.jl:517
_collect(::UnitRange{Int64}, ::TextParse.StrRange, ::Base.HasEltype, ::Base.HasLength) at ./array.jl:550
collect(::TextParse.StrRange) at ./array.jl:544
broadcastable(::TextParse.StrRange) at ./broadcast.jl:614
broadcasted at ./broadcast.jl:1159 [inlined]
Is the syntax I am using wrong?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment