Dear all,
I am extracting a number from a dataframe’s column and I need to to math with it. The number I extract lokks like this:
julia> x = sub_qry[:Column]
1-element Array{Union{Missing, Int64},1}:
107772
I have another variable:
julia> y
74
if I perform the calculation I need I obtain:
julia> z=len/sub_qry[:Column]
1×1 LinearAlgebra.Adjoint{Float64,Array{Float64,1}}:
0.0006866347474297591
the types of numbers are:
julia> typeof(x)
Array{Union{Missing, Int64},1}
julia> typeof(y)
Int64
julia> typeof(z)
LinearAlgebra.Adjoint{Float64,Array{Float64,1}}
I don’t feel confident with this LinearAlgebra
number so I would like to convert the numbers to normal types. Hence I tried to convert x to an integer but:
julia> parse(UInt32, x)
ERROR: MethodError: no method matching parse(::Type{UInt32}, ::Array{Union{Missing, Int64},1})
Closest candidates are:
parse(::Type{T<:Integer}, ::AbstractChar; base) where T<:Integer at parse.jl:38
parse(::Type{T<:Integer}, ::AbstractString; base) where T<:Integer at parse.jl:228
parse(::Type{T<:Real}, ::AbstractString) where T<:Real at parse.jl:366
Stacktrace:
[1] top-level scope at none:0
julia> convert(UInt32, x)
ERROR: MethodError: Cannot `convert` an object of type Array{Union{Missing, Int64},1} to an object of type UInt32
Closest candidates are:
convert(::Type{T<:Number}, ::T<:Number) where T<:Number at number.jl:6
convert(::Type{T<:Number}, ::Number) where T<:Number at number.jl:7
convert(::Type{T<:Integer}, ::Ptr) where T<:Integer at pointer.jl:23
...
Stacktrace:
[1] top-level scope at none:0
What is the correct procedure to convert an array to an integer of float in Julia?
Thank you