How to convert a column of a dataframe to an array of Float64

I have a one dimensional array of the following type:
5001-element Array{Union{Float64, Missings.Missing},1}

I want to convert it into a pure Float64 array to be able to process it with the function Statsbase.crosscor . How can I achieve that?
Missing values should be replaced with NaN.

Thanks for your replies!

Something like

v = [rand() > 0.90 ? missing : rand() for i in 1:10^4]
g(x) = x === missing ? NaN: x
g.(v)

perhaps?

In 0.7 you can just do

replace(df[col], missing=>NaN)

It’ll even know to change the array type to Vector{Float64}, which I was impressed with.

2 Likes

Fixed a typo:

Works like a charm!
Thank you!

1 Like