Hi All,
Just wondering how I can apply a function to rows containing vectors when doing a groupby → combine:
using DataFrames
df = DataFrame(group = ["A", "A", "B", "B"], v1 = [ [1, 2], [3, 4], [5, 6], [7, 8] ], v2 = [ [1, 2], [3, 4], [5, 6], [7, 8] ])
gdf = groupby(df, :group)
DataFrames.combine(gdf, 2:3 .=> sum)
returns
4×3 DataFrame
Row │ group v1_sum v2_sum
│ String Int64 Int64
─────┼────────────────────────
1 │ A 4 4
2 │ A 6 6
3 │ B 12 12
4 │ B 14 14
but I would like two rows, with column 2 and 3 containing vectors of length 2