Suppose we have something like this:
df = pd.DataFrame([[0,1,0,13], [1,0,1,14], [1,1,0,12], [1,0,0,15]], columns = ["A", "B" , "C", "p"])
A, B, C have binary values and I want to compute mean of p for each column, but for each group (1 and 0) separately.
For one column I use
df.groupby('A')['p'].mean()
But how to compute mean for columns ABC at once?