Error when using 'All' in 'DataFrames.combine'

I try the following code:

using DataFrames
df = DataFrame(a=1:3, b=4:6)
combine(df, All(:) .=> sum)

and get error:

ERROR: MethodError: no method matching length(::All{Tuple{Colon}})
Closest candidates are:
  length(::DataFrames.RowIndexMap) at C:\Users\meta\.julia\packages\DataFrames\GtZ1l\src\abstractdataframe\join.jl:62
  length(::CompositeException) at task.jl:41
  length(::LibGit2.GitBlob) at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.5\LibGit2\src\blob.jl:3
 [1] _similar_for(::UnitRange{Int64}, ::Type{Any}, ::All{Tuple{Colon}}, ::Base.HasLength) at .\array.jl:597
 [2] _collect(::UnitRange{Int64}, ::All{Tuple{Colon}}, ::Base.HasEltype, ::Base.HasLength) at .\array.jl:630
 [3] collect(::All{Tuple{Colon}}) at .\array.jl:624
 [4] broadcastable(::All{Tuple{Colon}}) at .\broadcast.jl:682
 [5] broadcasted(::Type{T} where T, ::All{Tuple{Colon}}, ::Function) at .\broadcast.jl:1260
 [6] top-level scope at REPL[6]:1

Is All usable with combine function?

The problem is that All() isn’t broadcastable.

You want names(df, All()) .=> mean.

This is something that will be fixed eventually, probably, but hasn’t been done yet.

1 Like

or just names(df) .=> mean in this case. As @pdeffebach noted this will be added, but it is not a top priority (i.e. if someone wants to implement it we will gladly review the PR but the core development effort is currently concentrated on other areas of the package).