Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs for aggregation over grouped array-like elements #3425

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions src/abstractdataframe/selection.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1665,6 +1665,22 @@ julia> combine(gd, :, AsTable(Not(:a)) => sum, renamecols=false)
7 │ 4 1 4 5
8 │ 4 1 8 9
```

# aggregation over array-like elements
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is not aggregation specific. @nalimilan - what would be the best comment here?
Maybe:

# protecting vectors returned from a function from being expanded into multiple rows

(but it seems long, but maybe it is OK)

```jldoctest
julia> df = DataFrame(a=[1, 1, 2, 2],
b=[[1, 2], [2, 3], [3, 4], [4, 5]]);

julia> gd = groupby(df, :a);

julia> combine(gd, :b => Ref∘sum)
2×2 DataFrame
Row │ a b_Ref_sum
│ Int64 Array…
─────┼──────────────────
1 │ 1 [3, 5]
2 │ 2 [7, 9]
```
"""
combine(df::AbstractDataFrame, @nospecialize(args...);
renamecols::Bool=true, threads::Bool=true) =
Expand Down