Each row of a DataFrame is itself a DataFrame.

Why not just store things in a vector of Line objects?

type Line{T}
        a::T
        pair::Int
end

df = DataFrame(A = Line[Line(1.0, 1), Line(2.0, 2)])

I've changed things from your code because there's a convention of using 
uppercase letters to start the names of types.

 -- John

On Apr 17, 2014, at 3:18 PM, Stéphane Laurent <[email protected]> wrote:

> Thank you. I need to extract the lines too. A line looks like
> 
>  type line{T}
>          a::T
>          pair:Int
>  end
> 
> This doesn't work, do you have something to propose :
> 
> D = DataFrame(A = [1.,2.], B = [1,2])
> D[1,:]::line{Float64}
> 
> ?
> 
> Le jeudi 17 avril 2014 23:48:29 UTC+2, Simon Kornblith a écrit :
> The most performant approach would be to store the columns as vectors in a 
> tuple or immutable. DataFrames can be nearly as performant if you:
> 
> - Extract columns (df[:mycol]) and index into them whenever possible instead 
> of indexing individual elements (df[1, :mycol])
> - Add typeasserts when you perform indexing operations 
> (df[:mycol]::Vector{Int}), or pass the columns to another function
> 
> Otherwise you will incur a slowdown because the compiler doesn't know the 
> types.
> 
> Simon
> 
> On Thursday, April 17, 2014 5:34:24 PM UTC-4, John Myles White wrote:
> It's actually possible to place pure Julia vectors in a DataFrame, which 
> might be convenient in this case. But you could always just store the columns 
> in a Vector{Any}, which is what the DataFrame does behind the scenes anyway.
> 
>  -- John
> 
> On Apr 17, 2014, at 2:27 PM, Stefan Karpinski <[email protected]> wrote:
> 
>> A DataFrame does seem like a good option, but those have NA support that you 
>> may not need. Can you elaborate a little more on the use case? Is it a fixed 
>> set of column names and types? Or will you need to support different schemas?
>> 
>> 
>> On Thu, Apr 17, 2014 at 5:16 PM, Stéphane Laurent <[email protected]> wrote:
>> Hello,
>> 
>>  I need to deal with some objects represented as arrays whose some columns 
>> are BigFloat, some columns are Int, some columns are logical. Is it a good 
>> idea to use a DataFrame ? Is there a better solution ?This is for a 
>> computationally intensive program.
>> 
> 

Reply via email to