Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Milan Bouchet-Valat <[email protected]>
  • Loading branch information
bkamins and nalimilan authored Sep 25, 2023
1 parent cd1c206 commit b107105
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/dataframe/insertion.jl
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ following way:
pushed to columns missing in `row` that are present in `df`.
If `row` is not a `DataFrameRow`, `NamedTuple`, `AbstractDict`, or `Tables.AbstractRow`
it is not allowed to pass `cols` keyword argument other than the default `:setequal`,
the `cols` keyword argument must be `:setequal` (the default),
because such rows do not provide column name information.
If `promote=true` and element type of a column present in `df` does not allow
Expand Down Expand Up @@ -538,8 +538,8 @@ julia> push!(DataFrame(a=1, b=2), (3, 4), (b=6, a=5))
function Base.push!(df::DataFrame, row::Any;
cols=:setequal, promote::Bool=false)
if cols !== :setequal
throw(ArgumentError("Passing `cols` keyword argument is not supported " *
"because `row` does not provide column names"))
throw(ArgumentError("`cols` can only be `:setequal` when `row` is a `$(typeof(row))` " *
"as this type does not provide column names"))
end

return _row_inserter!(df, -1, row, Val{:push}(), promote)
Expand Down Expand Up @@ -643,8 +643,8 @@ julia> pushfirst!(DataFrame(a=1, b=2), (3, 4), (b=6, a=5))
function Base.pushfirst!(df::DataFrame, row::Any;
cols=:setequal, promote::Bool=false)
if cols !== :setequal
throw(ArgumentError("Passing `cols` keyword argument is not supported " *
"because `row` does not provide column names"))
throw(ArgumentError("`cols` can only be `:setequal` when `row` is a `$(typeof(row))` " *
"as this type does not provide column names"))
end

return _row_inserter!(df, -1, row, Val{:pushfirst}(), promote)
Expand Down Expand Up @@ -739,8 +739,8 @@ julia> insert!(df, 3, NamedTuple(), cols=:subset)
function Base.insert!(df::DataFrame, index::Integer, row::Any;
cols=:setequal, promote::Bool=false)
if cols !== :setequal
throw(ArgumentError("Passing `cols` keyword argument is not supported " *
"because `row` does not provide column names"))
throw(ArgumentError("`cols` can only be `:setequal` when `row` is a `$(typeof(row))` " *
"as this type does not provide column names"))
end

index isa Bool && throw(ArgumentError("invalid index: $index of type Bool"))
Expand Down

0 comments on commit b107105

Please sign in to comment.