I want to change the datatypes of a column, I have tried doing that using the convert function to achieve this.
d = Dict("x" => [1,2,3,4,5],"y" => [6,7,8,9,10])
df = DataFrame(d)
df[:,"x"] = convert.(Float64, df[:,"x"])
This still produces a dataframe with type Int64 for column x
However using the dot notation to columns is successful,
df.x = convert.(Float64, df.x)
convert from type Int64 to Float64 successfully!
But in my case, I want to use for loop to convert data types in columns, so I am forced to use the first method (can think of a way to use the dot notation). Any ideas on how I can convert data types using a for a loop.
for nm in names(df)
df[:, nm] = convert.(Float64, df[:,nm])
end