I am trying to add a new column Y to a dataframe of type Float64 using another column Z of integer and an array X of type Array{Float64,1}.
When I run the command:
df[:Y] = map(z->X[z],df[:Z])
I get that that type of df[:X] is Any.
How can I change the type of df[:Y] to Float?
Example:
df = DataFrame( Z = @data([1, 2, 3, 4, 5]) )
X = [1.1 2.2 3.3 4.4 5.5]
df[:Y] = map(z->X[z],df[:Z])
then typeof(df[:Y]) returns DataArrays.DataArray{Any,1}.
df[:Y] = convert(DataArray{Float64,1}, map(z->X[z],df[:Z]))
Like that, or were you looking for something more?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With