what's wrong with the following sintaxis:
combine(gpd, :SepalWidth .=> [mean, sum] => [:mymean, :mysum] )
given that gdp is groupedDataFrame, and given that I want the columns :mymean and :mysum
what's wrong with the following sintaxis:
combine(gpd, :SepalWidth .=> [mean, sum] => [:mymean, :mysum] )
given that gdp is groupedDataFrame, and given that I want the columns :mymean and :mysum
Copyright © 2021 Jogjafile Inc.
You are missing a dot in broadcasting. The following should work:
EDIT
A crucial part of learning how to debug complex expressions in DataFrames.jl mini language is to understand that one can always check how broadcasting will handle the passed expression stand alone.
In this case you have:
so as you can see the result is a vector of two correct transformation operations.
Now let us have a look at:
This is clearly incorrect - as you try to store the result of
mean
as two columns. Instead if you write e.g.:all is correct again.
Interestingly, in some cases you can omit a dot in broadcasting (but this is rare). For instance:
give you exactly the same result (in this case the
identity
part means that you reuse the input column name as output column name). The result with=>
and.=>
in the second part is the same since the second and third of the whole expression have a single element.