I was reading some examples (from https://bkamins.github.io) about how to use DataFrames.jl to select, filter, combine… and I have a question.
df = DataFrame(
id = 1:4,
name = ["Aaron Aardvark", "Belen Barboza", "Elżbieta Elbląg", "Felipe Fittipaldi"],
age = [50, 45, 30, 25],
eye = ["blue", "brown", "blue", "brown"],
grade_1 = [95, 90, 95, 90],
grade_2 = [75, 90, 75, 95],
grade_3 = [85, 85, 80, 85]
)
select(df, :name => ByRow(x -> (; ([:firsname, :lastname] .=> split(x))...)))
What I don’t understand is this part:
(; ([:firsname, :lastname] .=> split(x))…
Why are they using a semicolon ; there?
Why do they need to spat … the output?
There is another thread about the semicolon
But I think it’s not the same. In that thread they use it to suppress printing the output.
Maybe in my example it’s related with “positional arguments” for functions, but I don’t understand it here.