Apply is 3-6x slower than agg in
#Python
But if one is not doing simple columnar summaries, one must use apply.
The equivalent apply code (the one using .SD) in
#rstats using data.table (second row) is much faster (especially if one groups by several factors e.g. 6x)
#BigData