JuliaData / JuliaData/DataFramesMeta.jl

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

Open
#361 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Julia
Stars
496
Forks
56
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the @by behavior using the supplied DataFrame example, comparing grouped :name values with the AsTable(:) result. Determine how grouped columns are passed into the requested calculation, then verify that myCurve can receive a single Symbol while existing vector behavior remains supported. Done means the example works with myCurve and related grouped calculations behave consistently.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
data
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.