I would like to apply some functions, such as mean and variance, to xmy column DataFramefor each unique value in the column y. I can imagine creating a loop that manually multiplies DataFrameto reach my end, but I try not to reinvent the wheel for something that is most likely a common function.
using DataFrames
mydf = DataFrame(y = [randstring(1) for i in 1:1000], x = rand(1000))
apply(function = mean, across = mydf[:x], by = mydf[:y])
source
share