Oh, I didn't realize that. So, `eachrow(df)` is giving you `[(:a,"hi"),(:x,0.703943)]` when you need `["hi",0.703943]` to use `push!`.
~~~ julia> df = DataFrame(a=["hi","there"],x = rand(2)) 2x2 DataFrame |-------|---------|----------| | Row # | a | x | | 1 | "hi" | 0.703943 | | 2 | "there" | 0.269876 | julia> df2 = DataFrame(a=["oh","yeah"],x = rand(2)) 2x2 DataFrame |-------|--------|----------| | Row # | a | x | | 1 | "oh" | 0.138966 | | 2 | "yeah" | 0.856162 | julia> for e = eachrow(df) push!(df2,[v for (_,v) in e]) end julia> df2 4x2 DataFrame |-------|---------|----------| | Row # | a | x | | 1 | "oh" | 0.138966 | | 2 | "yeah" | 0.856162 | | 3 | "hi" | 0.703943 | | 4 | "there" | 0.269876 | ~~~ Does this work for you? -- Leah On Fri, Sep 12, 2014 at 8:54 AM, Florian Oswald <florian.osw...@gmail.com> wrote: > yeah I wasn't very clear in that example. i really need to append one row > at a time. > > On 12 September 2014 14:50, Leah Hanson <astriea...@gmail.com> wrote: > >> Have you tried append!(df2,df)? >> >> ~~~ >> julia> using DataFrames >> >> >> >> julia> df = DataFrame(a=["hi","there"],x = rand(2)) >> >> >> 2x2 DataFrame >> |-------|---------|----------| >> | Row # | a | x | >> | 1 | "hi" | 0.862957 | >> | 2 | "there" | 0.101378 | >> >> >> >> julia> df2 = DataFrame(a=["oh","yeah"],x = rand(2)) >> >> >> 2x2 DataFrame >> |-------|--------|------------| >> | Row # | a | x | >> | 1 | "oh" | 0.00803615 | >> | 2 | "yeah" | 0.0222873 | >> >> >> >> julia> append!(df2,df) >> >> >> 4x2 DataFrame >> |-------|---------|------------| >> | Row # | a | x | >> | 1 | "oh" | 0.00803615 | >> | 2 | "yeah" | 0.0222873 | >> | 3 | "hi" | 0.862957 | >> | 4 | "there" | 0.101378 | >> ~~~ >> >> >> >> On Fri, Sep 12, 2014 at 7:57 AM, Florian Oswald <florian.osw...@gmail.com >> > wrote: >> >>> i'm trying to do this: >>> >>> using DataFrames >>> df = DataFrame(a=["hi","there"],x = rand(2)) >>> df2 = DataFrame(a=["oh","yeah"],x = rand(2)) >>> >>> for e in eachrow(df) >>> append!(df2,e) >>> end >>> >>> ERROR: `append!` has no method matching append!(::DataFrame, >>> ::DataFrameRow{DataFrame}) >>> in anonymous at no file:2 >>> >>> or >>> >>> julia> for i in 1:nrow(df) >>> push!(df2,df[i,:]) >>> end >>> >>> but that errors as well. >>> >>> this works: >>> >>> julia> for i in 1:nrow(df) >>> push!(df2,array(df[i,:])) >>> end >>> >>> but wondering whether that's the best way of achieving this efficiently. >>> >> >> >