I am just starting Julia and doing some column manipulation. However, I found myself into a column type called Vector{Decimal}
. I'd like to convert it into something more common like Float64.
I tried to use the convert(Float64, df.difference)
, but I got this foloowing error:
ERROR: MethodError: Cannot `convert` an object of type Vector{Decimals.Decimal} to an object of type Float64
What's the best way to handle this type of column? Here is my dataframe:
julia> df1[1:5, :]
5×3 DataFrame
Row │ base_msrp sales_amount difference
│ Decimal…? Float64? Decimal…
─────┼─────────────────────────────────────
1 │ 599.99 479.992 119.998
2 │ 599.99 599.99 -0.00
3 │ 599.99 479.992 119.998
4 │ 599.99 539.991 59.999
5 │ 599.99 539.991 59.999
question from:
https://stackoverflow.com/questions/65644599/how-to-convert-vectordecimal-to-float64-in-julia 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…