df = pd.DataFrame({'subset_product':['A','A','B','C','C','D'],
'success': [1, 0, 1, 1, 0, 0],
'count':[5,4,1,1,1,0]})
Above is dataframe. success =1 means success and success = 0 mean failure.. count = number of such event. Need to get success percent for each subset product.
expected output:
A 5/9
B 1
C 1/2
D 0
I am getting the count using below:
a = df.groupby('subset_product')['count'].transform('sum')
But, stuck here with count itself..