So, I'm trying to do something similar to this:
select a, b, c, sum(d), sum(e), count(*)
from df
group by 1,2,3
In other words, I have this:
a b c d e
Billy Profesor 1 10 5
Billy Profesor 1 17 3
Andrew Student 8 2 7
And I want the output to be:
a b c d e count
Billy Profesor 1 27 8 2
Andrew Student 8 2 7 1
I tried this, and it partially worked:
df.groupby(['a','b','c']).sum().reset_index()
I still couldn't make it work for the count. I also tried the answer in the post Group dataframe and get sum AND count?, but using the agg function make things very messy and it counts every column.
UPDATE: I changed column c because I have a numeric column to group, but not sum.