Closed ctarn closed 10 months ago
The mental model you should have is that number of rows per group is adjusted to values returned in args in combine
. If args is empty the number of rows per group is 0 so you get an empty data frame.
if you want to keep grouping variable then you have two options. Keep the number of rows from the source:
julia> DataFrames.combine(gd, :x)
3×1 DataFrame
Row │ x
│ Int64
─────┼───────
1 │ 1
2 │ 2
3 │ 2
Keep one row per group (as in your original post):
julia> DataFrames.combine(gd, :x => first => :x)
2×1 DataFrame
Row │ x
│ Int64
─────┼───────
1 │ 1
2 │ 2
thanks