In my case I load the following csv data (https://ourworldindata.org/coronavirus-source-data) by using the CSV module and importing it like that:
using DataFrames
using CSV
raw = CSV.read("data.csv")
Then I want to set a string column by indexing it like that:
raw[1, :location] = "AA"
and I get the following error:
setindex! not defined for CSV.Column{String,PooledString}
Stacktrace:
[1] error(::String, ::Type) at ./error.jl:42
[2] error_if_canonical_setindex(::IndexLinear, ::CSV.Column{String,PooledString}, ::Int64) at ./abstractarray.jl:1006
[3] setindex!(::CSV.Column{String,PooledString}, ::String, ::Int64) at ./abstractarray.jl:997
[4] insert_single_entry!(::DataFrame, ::String, ::Int64, ::Symbol) at /home/chris/.julia/packages/DataFrames/S3ZFo/src/dataframe/dataframe.jl:452
[5] setindex!(::DataFrame, ::String, ::Int64, ::Symbol) at /home/chris/.julia/packages/DataFrames/S3ZFo/src/dataframe/dataframe.jl:491
[6] top-level scope at In[31]:1
Has this something to do with my types or am I doing something wrong completely? For a simple example it seems to works that way:
df=DataFrames.DataFrame(A=[1,2],B=[3,4])
df[2,:A]=7