diff --git a/src/dataframerow/dataframerow.jl b/src/dataframerow/dataframerow.jl index f8a035262..5107c8b6a 100644 --- a/src/dataframerow/dataframerow.jl +++ b/src/dataframerow/dataframerow.jl @@ -264,7 +264,7 @@ index(r::DataFrameRow) = getfield(r, :colindex) is_column_insertion_allowed(dfr::DataFrameRow) = index(dfr) isa Index Base.@propagate_inbounds function Base.setindex!(dfr::DataFrameRow, value, idx) - if colinds isa SymbolOrString && columnindex(dfr, colinds) == 0 + if idx isa SymbolOrString && columnindex(dfr, idx) == 0 if !is_column_insertion_allowed(dfr) throw(ArgumentError("creating new columns in a DataFrameRow that subsets " * "columns of its parent data frame is disallowed")) @@ -273,7 +273,7 @@ Base.@propagate_inbounds function Base.setindex!(dfr::DataFrameRow, value, idx) newcol = similar(val, Union{T,Missing}, nrow(parent(dfr))) fill!(newcol, missing) newcol[row(dfr)] = val - parent(dfr)[!, colinds] = newcol + parent(dfr)[!, idx] = newcol else setindex!(parent(dfr), value, row(dfr), parentcols(index(dfr), idx)) end