# Update a value in DataFrames.jl

**URL:** <https://discourse.julialang.org/t/update-a-value-in-dataframes-jl/43307>\
**Category:** New to Julia\
**Tags:** question, dataframes\
**Created:** [July 18, 2020, 7:41pm UTC](https://discourse.julialang.org/t/update-a-value-in-dataframes-jl/43307 "2020-07-18T19:41:27Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![PabloGalaz](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pablogalaz/32/16281_2.png) [@PabloGalaz](https://discourse.julialang.org/u/PabloGalaz)\
**Post date:** [July 18, 2020, 7:41pm UTC](https://discourse.julialang.org/t/update-a-value-in-dataframes-jl/43307/1 "2020-07-18T19:41:27Z")

</div>

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.

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

```

But the console show me this error

```julia
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?

---

<div class="post-metadata">

**Author:** ![lungben](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lungben/32/12314_2.png) [@lungben](https://discourse.julialang.org/u/lungben)\
**Post date:** [July 18, 2020, 8:36pm UTC](https://discourse.julialang.org/t/update-a-value-in-dataframes-jl/43307/2 "2020-07-18T20:36:17Z")

</div>

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

> [@\[ANN\] CSV.jl 0.7 Release](https://discourse.julialang.org/t/ann-csv-jl-0-7-release/42162/36):
>
> I would advise against using DataFrame!(CSV.File(file; kw...)) if you plan on doing any mutating of your data frame. It’s safer to use DataFrame(CSV.File(file; kw...)) Otherwise you’ll run into problems like this: “df.csv” file: x,y a,1 b,2 Code julia\> using DataFrames, CSV julia\> df = DataFrame!(CSV.File("df.csv")) 2×2 DataFrame │ Row │ x │ y │ │ │ String │ Int64 │ ├─────┼────────┼───────┤ │ 1 │ a │ 1 │ │ 2 │ b │ 2 │ julia\> filter!(r -\> r.x == "b", …

Maybe updating your packages helps.

---

<div class="post-metadata">

**Author:** ![PabloGalaz](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pablogalaz/32/16281_2.png) [@PabloGalaz](https://discourse.julialang.org/u/PabloGalaz)\
**Post date:** [July 20, 2020, 10:54pm UTC](https://discourse.julialang.org/t/update-a-value-in-dataframes-jl/43307/3 "2020-07-20T22:54:04Z")

</div>

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