Hello everyone,
I’m trying to add a new column (in the first position) to an existing DataFrame (df) from an existing array (members) but when I run insertcols!(df,1, :Members =>members)
, it show me following error:
ArgumentError: adding AbstractArray other than AbstractVector as a column of a data frame is not allowed
Stacktrace:
[1] insertcols!(::DataFrame, ::Int64, ::Pair{Symbol,Array{String,2}}; makeunique::Bool, copycols::Bool) at /Users/pablogalaz/.julia/packages/DataFrames/kwVTY/src/dataframe/dataframe.jl:760
[2] insertcols!(::DataFrame, ::Int64, ::Pair{Symbol,Array{String,2}}) at /Users/pablogalaz/.julia/packages/DataFrames/kwVTY/src/dataframe/dataframe.jl:721
[3] top-level scope at In[44]:1
I already try to do this with other df-array and it works very well. The rest of the code here:
members = ["Belen" "Lau" "Javi" "Joaco" "Nico" "Rodrigo" "Vicente" "Pablo" "Falcao" "Montse"]
df =
Row Lunes Martes Miercoles Jueves Viernes Sabado Domingo
Int64 Int64 Int64 Int64 Int64 Int64 Int64
1 0 0 1 0 0 -1 -1
2 1 0 0 0 1 -1 -1
3 0 0 1 -1 0 -1 1
4 1 0 0 1 1 -1 -1
5 1 1 0 -1 0 1 -1
6 0 1 0 -1 1 1 -1
7 0 1 0 -1 1 -1 1
8 1 1 0 1 0 -1 -1
9 0 0 1 1 -1 1 -1
10 0 0 1 1 -1 -1 1
insertcols!(df,1, :Members =>members) #ERROR