We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
convert
I'm not sure if this is a core DataValues issue or one with the implementation in ExcelFiles or DataFrames (where I posted the same issue): queryverse/ExcelFiles.jl#13 JuliaData/DataFrames.jl#1478
(I'll close the inappropriate issues once I figure out where the issue is)
I have dataframe df where column 1 is an array of DataValues.DataValue{Any}. How can I convert it to DateTime, and allow for missing?
This doesn’t work:
datetimes = convert(Vector{Union{DateTime,Missing}}, df[1])
MethodError: Cannot `convert` an object of type DataValues.DataValue{Any} to an object of type DateTime
The text was updated successfully, but these errors were encountered:
Here's a concise example for testing:
using DataFrames, Dates, ExcelFiles filename = "test.xlsx" df = DataFrame(load(filename, string("Sheet1!A1:E25"),header=true)) df[:DateTime] = convert(Vector{Union{DateTime, Missing}},df[:DateTime])
And source excel file: https://www.dropbox.com/s/cwq5m6m9179s57a/test.xlsx?dl=1
Sorry, something went wrong.
I've written a temporary function to fix the columns:
function fixcolumn(col,T) arr = Vector{Union{Missing, T}}(0) for x in col try push!(arr,x.value) catch push!(arr,missing) end end return arr end
For instance:
df[:DateTime] = fixcolumn(df[:DateTime],DateTime)
No branches or pull requests
I'm not sure if this is a core DataValues issue or one with the implementation in ExcelFiles or DataFrames (where I posted the same issue):
queryverse/ExcelFiles.jl#13
JuliaData/DataFrames.jl#1478
(I'll close the inappropriate issues once I figure out where the issue is)
I have dataframe df where column 1 is an array of DataValues.DataValue{Any}.
How can I convert it to DateTime, and allow for missing?
This doesn’t work:
The text was updated successfully, but these errors were encountered: