You can append a one-row DataFrame to your existing DataFrame. — John
On May 26, 2014, at 8:59 AM, Tomas Lycken <[email protected]> wrote: > I'm probably just being incredibly daft, but I can't figure out how to add a > new row to a DataFrame. > > Basically, I have a bunch of data sets for which I want to perform some > calculations - lets say the mean and standard deviation of something - each > dataset corresponding to some named category of data. So I do the following > to construct my new DataFrame > > julia> measures = DataFrame() > julia> measures[:Mean] = Float64[] > julia> measures[:StdDev] = Float64[] > julia> measures[:Category] = Symbol[] > > Now, I want to add some values that are the results of a calculation on a > different data set, and I try this: > > julia> push!(psispread, [1.0,0.1,:Fake]) > ERROR: no method push!(DataFrame, Array{Any,1}) > julia> append!(psispread, [1.0,0.1,:Fake]) > ERROR: no method append!(DataFrame, Array{Any,1}) > julia> psispread[1,:] = [1.0,0.1,:Fake] > ERROR: BoundsError() > in setindex! at /home/tlycken/.julia/v0.3/DataArrays/src/dataarray.jl:764 > in insert_single_entry! at > /home/tlycken/.julia/v0.3/DataFrames/src/dataframe/dataframe.jl:410 > in setindex! at > /home/tlycken/.julia/v0.3/DataFrames/src/dataframe/dataframe.jl:521 > > Is there a nice and simple way to add a row to a DataFrame without having to > do it one value at a time? > > // T
