Let's say I have dataframe and vector such as :
dataframe = DataFrame(Data1 = rand(10), Data2 = rand(10));
Data3 = rand(10)
I want to add Data3 to the dataframe such as:
Data1 Data2 Data3
Float64 Float64 Float64
1 0.757345 0.903133 0.502133
2 0.294749 0.327502 0.323133
3 0.156397 0.427323 0.123133
In Python, I can just df["Data3"] = Data3 to add column, but in Julia dataframe, df[!,Data3] = Data3 returns :
- MethodError: no method matching setindex!(::DataFrame, ::Vector{Float64}, ::typeof(!), ::Vector{Float64})
Also I've checked this solution, but this gave me :
- ArgumentError: syntax df[column] is not supported use df[!, column] instead.
How can I add vector as a new column in Julia Dataframe?