# Converting Missing to Date

**URL:** <https://discourse.julialang.org/t/converting-missing-to-date/71150>\
**Category:** New to Julia\
**Tags:** dataframes\
**Created:** [November 8, 2021, 1:42pm UTC](https://discourse.julialang.org/t/converting-missing-to-date/71150 "2021-11-08T13:42:13Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jnewbie](https://avatars.discourse-cdn.com/v4/letter/j/53a042/32.png) [@jnewbie](https://discourse.julialang.org/u/jnewbie)\
**Post date:** [November 8, 2021, 1:42pm UTC](https://discourse.julialang.org/t/converting-missing-to-date/71150/1 "2021-11-08T13:42:13Z")

</div>

Hello everyone,

I am trying to do this operation on my DataFrame:

```julia
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:

```julia
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 :

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

```

I get this error :

```julia
MethodError: no method matching Int64(::Date)

```

Does anyone have any ideas?

Thank you,

---

<div class="post-metadata">

**Author:** ![sijo](https://avatars.discourse-cdn.com/v4/letter/s/da6949/32.png) [@sijo](https://discourse.julialang.org/u/sijo)\
**Post date:** [November 8, 2021, 2:30pm UTC](https://discourse.julialang.org/t/converting-missing-to-date/71150/2 "2021-11-08T14:30:17Z")

</div>

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](https://discourse.julialang.org/t/please-read-make-it-easier-to-help-you/14757).

---

<div class="post-metadata">

**Author:** ![jnewbie](https://avatars.discourse-cdn.com/v4/letter/j/53a042/32.png) [@jnewbie](https://discourse.julialang.org/u/jnewbie)\
**Post date:** [November 8, 2021, 2:39pm UTC](https://discourse.julialang.org/t/converting-missing-to-date/71150/3 "2021-11-08T14:39:35Z")

</div>

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

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

```
