Update a value in DataFrames.jl

Hello everyone,

Im using Julia 1.4.2 and DataFrames.jl 0.21.2 and I have the follow problem.

I have an Dict with values that I want to replace in the column of certain DataFrame. The keys is a name and the value a Int. The DataFrame has a column named “Members” where I can find the names that are contained in the Dict as key. I want to subset the DataFrame and replace the value in the Dict on the (row,col) right.

I already read the documentación and I couldnt find the error. The code is the next one.

for (m,member) in enumerate(members_info.Members)
   members_info[m,:Workload]= dict_info[member]
end

But the console show me this error

setindex! not defined for CSV.Column{Int64,Int64}

Stacktrace:
 [1] error(::String, ::Type{T} where T) at ./error.jl:42
 [2] error_if_canonical_setindex(::IndexLinear, ::CSV.Column{Int64,Int64}, ::Int64) at ./abstractarray.jl:1081
 [3] setindex!(::CSV.Column{Int64,Int64}, ::Int64, ::Int64) at ./abstractarray.jl:1072
 [4] insert_single_entry!(::DataFrame, ::Int64, ::Int64, ::Symbol) at /Users/pablogalaz/.julia/packages/DataFrames/kwVTY/src/dataframe/dataframe.jl:523
 [5] setindex!(::DataFrame, ::Int64, ::Int64, ::Symbol) at /Users/pablogalaz/.julia/packages/DataFrames/kwVTY/src/dataframe/dataframe.jl:557
 [6] top-level scope at ./In[101]:5

How can I update the value in my “members_info” DataFrame?

Just guessing - could it be the same issue as here?

Maybe updating your packages helps.

1 Like

Thank you! This was the solution, I only was reading with CSV.read, not with DataFrame() function.

1 Like