How do I use the categorical=true feature of CSV.validate(…)?
I’ve tried a bunch of variations, and keep getting the error “ERROR: TypeError: in setfield!, expected Union{Missing, CategoricalString{UInt32}}, got String”.
I have two test files called “data/tmp1.csv” and “data/tmp2.csv”. The contents tmp1 are the two lines:
0001000
0001000
The contents tmp2 are the two lines:
“0001000”
“0001000”
I’ve defined the following variables for use in the CSV.validate(…) call.
colNames=[:senID]
colTypes=Dict(:senID=>String)
colTypes2=Dict(:senID=>CategoricalString{UInt32})
I’ve tried all the following variations, plus others, and still get the error above. Can someone tell how to do this correctly?
CSV.validate(“data/tmp1.csv”,header=colNames, types=colTypes, categorical=true, allowmissing=:none, strict=true)
CSV.validate(“data/tmp2.csv”,header=colNames, types=colTypes, categorical=true, allowmissing=:none, strict=true)
CSV.validate(“data/tmp1.csv”,header=colNames, types=colTypes2, categorical=true, allowmissing=:none, strict=true)
CSV.validate(“data/tmp2.csv”,header=colNames, types=colTypes2, categorical=true, allowmissing=:none, strict=true)
CSV.validate(“data/tmp1.csv”,header=colNames, types=colTypes, categorical=true, allowmissing=:none, strict=true)
CSV.validate(“data/tmp1.csv”,header=colNames, types=colTypes, typemap=tmpmap, categorical=true, allowmissing=:none, strict=true)
Thanks for your attention and help!