Converting Missing to Date

Hello everyone,

I am trying to do this operation on my DataFrame:

for i in 1:nrow(df2)
 for k in a
            df1[k,:col3] = max(datetime2unix(DateTime(Dates.today() + Dates.Day(60))), datetime2unix(DateTime(df2[i,:col5])))
 end
end

And I get this error:

LoadError: MethodError: convert(::Type{Union{}}, ::Float64) is ambiguous.

To remedy this I want to change the type of df1[k,:col3] :Vector{Missing} (alias for Array{Missing, 1}) (empty column of the dataframe) to Date Vectors.

But when I try :

date_format = DateFormat("y-m-d")
df1[:,:col3]= Date.(df1[:,:col3],date_format)

I get this error :

MethodError: no method matching Int64(::Date)

Does anyone have any ideas?

Thank you,

Try df1[!,:col3]=... This will replace the column with a new vector (of possibly different type) instead of assigning to the existing vector.

If that doesn’t work please include a MWE.

Thank you and I resolved my problem by doing this when I create my column :

df1 = insertcols!(df1,30,:col3 => datetime2unix(DateTime(0)))