From d5c79793af6db0dcc1eac01338f887a7bea16f18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bogumi=C5=82=20Kami=C5=84ski?= Date: Thu, 5 Oct 2023 17:20:49 +0200 Subject: [PATCH] Apply suggestions from code review Co-authored-by: Milan Bouchet-Valat --- src/dataframe/insertion.jl | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/dataframe/insertion.jl b/src/dataframe/insertion.jl index 237505cc2..1655dcb19 100644 --- a/src/dataframe/insertion.jl +++ b/src/dataframe/insertion.jl @@ -1103,11 +1103,9 @@ end function Base.push!(df::DataFrame, @nospecialize rows...; cols::Symbol=:setequal, promote::Bool=(cols in [:union, :subset])) - if isempty(rows) - if !(cols in (:orderequal, :setequal, :intersect, :subset, :union)) - throw(ArgumentError("`cols` keyword argument must be " * - ":orderequal, :setequal, :intersect, :subset or :union)")) - end + if !(cols in (:orderequal, :setequal, :intersect, :subset, :union)) + throw(ArgumentError("`cols` keyword argument must be " * + ":orderequal, :setequal, :intersect, :subset or :union)")) end with_names_count = count(rows) do row row isa Union{DataFrameRow,AbstractDict,NamedTuple,Tables.AbstractRow} @@ -1122,11 +1120,9 @@ end function Base.pushfirst!(df::DataFrame, @nospecialize rows...; cols::Symbol=:setequal, promote::Bool=(cols in [:union, :subset])) - if isempty(rows) - if !(cols in (:orderequal, :setequal, :intersect, :subset, :union)) - throw(ArgumentError("`cols` keyword argument must be " * - ":orderequal, :setequal, :intersect, :subset or :union)")) - end + if !(cols in (:orderequal, :setequal, :intersect, :subset, :union)) + throw(ArgumentError("`cols` keyword argument must be " * + ":orderequal, :setequal, :intersect, :subset or :union)")) end with_names_count = count(rows) do row row isa Union{DataFrameRow,AbstractDict,NamedTuple,Tables.AbstractRow}