Skip to content

Request - grouped by columns available as single values rather than vectors #361

Open
@Lincoln-Hannah

Description

@Lincoln-Hannah

Would it be possible, within a @by block, to make the grouped by columns available as single values rather then vectors?

In the below, I'd like to create a column of myCurve structs, but because the :name column comes through as a vector, it only works for the myCurve_name_vec structs. I could convert it, it just wouldn't be so clean.

More generally, if you are grouping by a column, any related calculations would likely use that column as a single value.


@with_kw struct myCurve    
    name::Symbol
    curve::Vector{Int64}
end

@with_kw struct myCurve_name_vec
    name::Vector{Symbol}
    curve::Vector{Int64}
end


d = DataFrame( name=[:a,:a,:a,:b,:b,:b], curve =[1,2,3,11,12,13] )

@by d :name   :x = myCurve_with_vec( AsTable(:)... )    #works
@by d :name   :x = myCurve( AsTable(:)... )                   #doesn't work

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions