Docstring for hcat(DataFrame...) varargs returns the default Base.hcat docs

Probably, this is not something specific to DataFrames.jl but a general situation.
Normally the following code

julia> using DataFrames;

julia> df1 = DataFrame(a=[1,2,3,4,5], b=[10,20,30,40,50]);

julia> df2 = DataFrame(c=[100,200,300,400,500], d = [1000, 2000, 3000, 4000, 5000]);

help?> hcat(df1, df2)

should return Functions · DataFrames.jl
but it returns Arrays · The Julia Language

The feature of argument-type-specific docstring seems to be in place since

help?> length([1,2,3])


help?> length("ena")

return different output related to the argument type.

So, why is the there the issue with the DataFrames case ? Maybe it’s a varargs... thing ?

1 Like

I am not sure what is the reason of the problem since:

julia> @which hcat(df, df)
hcat(df1::AbstractDataFrame, df2::AbstractDataFrame; makeunique, copycols)
     @ DataFrames ~\DataFrames\58MUJ\src\abstractdataframe\abstractdataframe.jl:1608

Maybe it is an issue with the signature in the docstring:

         makeunique::Bool=false, copycols::Bool=true)

or the fact that this docstring is above:

function Base.hcat(df::AbstractDataFrame; makeunique::Bool=false, copycols::Bool=true)


Probably some people knowing more how docstrings are invoked could help here.

CC @nalimilan

Yes to fix this we we should attach the docstring to a Base.hcat(df::AbstractDataFrame, xs::Union{AbstractVector, AbstractDataFrame}...) method. But currently that method doesn’t exist as we have a two-argument method and a three-argument method.