It shouldn't be that hard to make the array version work.  I might give it
a shot, unless that isn't desired.

Kevin

On Monday, May 26, 2014, Jason Solack <[email protected]> wrote:

> this works for me:
>
> dfA = DataFrame(A=[1:10], B=[11:20])
> dfB = DataFrame(A=11, B=21)
> append!(dfA, dfB)
>
>
>
> On Monday, May 26, 2014 11:59:28 AM UTC-4, Tomas Lycken 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
>>
>

Reply via email to