Hi,
I have been stumped on how to convert a Any
with nothing
to a Float64
with missing
.
The data I am importing from BigQuery using gbq_query. The returned NULLS are as blank.
I try the normal passmissing parse method:
df_transformed = @chain df_raw begin
@transform(
:avg_theoretical_mrr = passmissing(parse).(Float64, :avg_theoretical_mrr)
)
end
but get the error:
ERROR: MethodError: no method matching parse(::Type{Float64}, ::Nothing)
Since nothing
is not missing
I figured I would replace nothing with missing:
df_transformed.avg_theoretical_mrr = replace.(df_transformed.avg_theoretical_mrr, nothing => missing)
but get the error:
ERROR: MethodError: no method matching similar(::Missing, ::Type{Any})
I even tried to switch these to strings but this merely switched nothing to “nothing” and it won’t allow me to replace “nothing” with missing in a string…
But here is the question: is there an easy way to take type Any with blanks and convert them to Floats with missing succinctly?