Append one line to similar DataFrame gives eltype error

Hi,

I try top append a line to 2 similar DataFrames, using the strategy described here before DataFrame recent update :

But I have some problem because I do not manage to use append!() function without eltype error. Since the 2 DataFrames are similar, I expect the columns to have the same eltype.

Thank you for your help !

julia> typeof(x)
DataFrames.DataFrame

julia> y = similar(x,0)
0×6 DataFrames.DataFrame

julia> typeof(y)
DataFrames.DataFrame

julia> append!(y, x[4,:])
ERROR: Column eltypes do not match
Stacktrace:
 [1] append!(::DataFrames.DataFrame, ::DataFrames.DataFrame) at /home/fred/.julia/v0.6/DataFrames/src/dataframe/dataframe.jl:778

julia> eltypes(x)
6-element Array{Type,1}:
 WeakRefString{UInt8}                       
 CategoricalArrays.CategoricalString{UInt32}
 CategoricalArrays.CategoricalString{UInt32}
 CategoricalArrays.CategoricalString{UInt32}
 CategoricalArrays.CategoricalString{UInt32}
 Float64                                    

julia> eltypes(y)
6-element Array{Type,1}:
 Union{Missings.Missing, WeakRefString{UInt8}}                       
 Union{CategoricalArrays.CategoricalString{UInt32}, Missings.Missing}
 Union{CategoricalArrays.CategoricalString{UInt32}, Missings.Missing}
 Union{CategoricalArrays.CategoricalString{UInt32}, Missings.Missing}
 Union{CategoricalArrays.CategoricalString{UInt32}, Missings.Missing}
 Union{Float64, Missings.Missing}

I found a solution, not very elegant but it works : since similar() does not produce exactly the same eltypes for the column, a solution is to make a copy of one line :

julia> append!(y, x[4,:])
ERROR: Column eltypes do not match

julia> z = copy(x[4,:])
1×6 DataFrames.DataFrame. Omitted printing of 4 columns

julia> append!(z, x[5,:])
2×6 DataFrames.DataFrame. Omitted printing of 4 columns

AFAIK this should be fixed in DataFrames master, should be in the last next release:
https://github.com/JuliaData/DataFrames.jl/pull/1298

thank you @nalimilan for this good news :wink: