I'm having data frame like this:
cust_id s1 s2
1 100 0
2 100 1
3 90 1
4 85 0
5 90 1
and I'm trying to get the following output:
s1 s1(Count) s2(sum)
100 2 1
90 2 2
85 1 0
I tried to use groupby
and size/sum
(like in here: Pandas: Create a new Data Frame using multiple GroupBy results):
e.g.,
abc = df.groupby(by="s1")["s1","s2"].sum()
## I don't know how to create count for s1 and sum for s2
Your help will be appreciated!