DataFrame transform with many output columns

Hello!

I can split string columns in dataframe as follows:

s = DataFrame(grid = "uuu_mygrid", e = [3,3,3])
transform(s, :grid => (ByRow(x -> split(x,"_"))) => AsTable)

But how can I specify the new column names?

just pass the column names you want:

julia> transform(s, :grid => (ByRow(x -> split(x,"_"))) => [:col1, :col2])
3Γ—4 DataFrame
 Row β”‚ grid        e      col1       col2
     β”‚ String      Int64  SubStrin…  SubStrin…
─────┼─────────────────────────────────────────
   1 β”‚ uuu_mygrid      3  uuu        mygrid
   2 β”‚ uuu_mygrid      3  uuu        mygrid
   3 β”‚ uuu_mygrid      3  uuu        mygrid
2 Likes