ExcelFiles.jl icon indicating copy to clipboard operation
ExcelFiles.jl copied to clipboard

Cannot convert from DataValues.DataValue{Any} to DateTime

Open IanButterworth opened this issue 7 years ago • 3 comments

I'm trying to convert a row in an imported excel file into an array of DateTime allowing missing values.

using ExcelFiles, DataFrames

f_labs = "file.xlsx"  
df = DataFrame(load(filename, "4!C1:X6"),header=false))
datetimearray = convert(Array{Union{Missings.Missing,DateTime}},df[2,:])
MethodError: Cannot `convert` an object of type DataValues.DataValue{Any} to an object of type DateTime

What's the correct way to do this?

IanButterworth avatar Aug 11 '18 13:08 IanButterworth

This is a bug somewhere in my stack. The DataFrame you get there should never have a DataValue in it, it should automatically use Missing.

Note that Queryverse in general, and ExcelFiles in particular, are not completely ported to 0.7/1.0.

davidanthoff avatar Aug 11 '18 21:08 davidanthoff

Ok. I ended up expanding on the wrong issue post then.

I'm sure it won't help you, but for anyone coming up against this needing help in the interim: https://github.com/queryverse/DataValues.jl/issues/47

IanButterworth avatar Aug 11 '18 21:08 IanButterworth

Sometimes it shows cannot convert Any, would it be useful if it automatically call repr() on these?

xgdgsc avatar Jan 27 '19 06:01 xgdgsc