diff --git a/src/abstractdataframe/abstractdataframe.jl b/src/abstractdataframe/abstractdataframe.jl index d929faf9b1..0277016a88 100644 --- a/src/abstractdataframe/abstractdataframe.jl +++ b/src/abstractdataframe/abstractdataframe.jl @@ -1023,7 +1023,7 @@ end _filter_helper(f, cols...)::BitVector = ((x...) -> f(x...)::Bool).(cols...) -@inline function Base.filter((cols, f)::Pair{<:AsTable}, df::AbstractDataFrame; +@inline function Base.filter((cols, f)::Pair{AsTable}, df::AbstractDataFrame; view::Bool=false) df_tmp = select(df, cols.cols, copycols=false) if ncol(df_tmp) == 0 @@ -1547,14 +1547,15 @@ Base.vcat(dfs::AbstractDataFrame...; AbstractVector{<:AbstractString}}=:setequal) = reduce(vcat, dfs; cols=cols) -Base.reduce(::typeof(vcat), - dfs::Union{AbstractVector{<:AbstractDataFrame}, - Tuple{Vararg{AbstractDataFrame}}}; - cols::Union{Symbol, AbstractVector{Symbol}, - AbstractVector{<:AbstractString}}=:setequal) = - _vcat([df for df in dfs if ncol(df) != 0]; cols=cols) +function Base.reduce(::typeof(vcat), + dfs::Union{AbstractVector{<:AbstractDataFrame}, + Tuple{AbstractDataFrame, Vararg{AbstractDataFrame}}}; + cols::Union{Symbol, AbstractVector{Symbol}, + AbstractVector{<:AbstractString}}=:setequal) + return _vcat(AbstractDataFrame[df for df in dfs if ncol(df) != 0]; cols=cols) +end -function _vcat(dfs::AbstractVector{<:AbstractDataFrame}; +function _vcat(dfs::AbstractVector{AbstractDataFrame}; cols::Union{Symbol, AbstractVector{Symbol}, AbstractVector{<:AbstractString}}=:setequal) @@ -1586,13 +1587,15 @@ function _vcat(dfs::AbstractVector{<:AbstractDataFrame}; if !isempty(coldiff) # if any DataFrames are a full superset of names, skip them - filter!(u -> !issetequal(u, header), uniqueheaders) + let header=header # julia #15276 + filter!(u -> !issetequal(u, header), uniqueheaders) + end estrings = map(enumerate(uniqueheaders)) do (i, head) matching = findall(h -> head == h, allheaders) headerdiff = setdiff(coldiff, head) - cols = join(headerdiff, ", ", " and ") + badcols = join(headerdiff, ", ", " and ") args = join(matching, ", ", " and ") - return "column(s) $cols are missing from argument(s) $args" + return "column(s) $badcols are missing from argument(s) $args" end throw(ArgumentError(join(estrings, ", ", ", and "))) end diff --git a/src/groupeddataframe/splitapplycombine.jl b/src/groupeddataframe/splitapplycombine.jl index cc59e79153..5bbe77496a 100644 --- a/src/groupeddataframe/splitapplycombine.jl +++ b/src/groupeddataframe/splitapplycombine.jl @@ -484,7 +484,7 @@ function prepare_idx_keeprows(idx::AbstractVector{<:Integer}, end function _combine(gd::GroupedDataFrame, - @nospecialize(cs_norm::Vector{Any}), optional_transform::Vector{Bool}, + cs_norm::Vector{Any}, optional_transform::Vector{Bool}, copycols::Bool, keeprows::Bool, renamecols::Bool) if isempty(cs_norm) if keeprows && nrow(parent(gd)) > 0 && minimum(gd.groups) == 0 diff --git a/src/other/index.jl b/src/other/index.jl index e05bc4809c..de035a32d1 100644 --- a/src/other/index.jl +++ b/src/other/index.jl @@ -422,7 +422,7 @@ Base.@propagate_inbounds SubIndex(parent::AbstractIndex, cols) = SubIndex(parent, parent[cols]) Base.length(x::SubIndex) = length(x.cols) -Base.names(x::SubIndex) = string.(_names(x)) +Base.names(x::SubIndex) = string.(_names(x))::Vector{String} _names(x::SubIndex) = view(_names(x.parent), x.cols) function Base.haskey(x::SubIndex, key::Symbol)