I have DataFrame like this
d = {'id': [1, 2, 3, 4, 5, 6],
'y_true': [0, 0, 1, 1, 1, 0],
'y_pred': [0.23, 0.01, 0.19, 0.01, 0.3, 0.23]
}
df = pd.DataFrame(data=d)
And I want to groupby y_pred and then groupby y_true for the same columns to find mean y_true for each row, corresponding to y_pred. So to speak
d1 = {'y_true': [0, 0.5, 1, 1],
'y_pred': [0.23, 0.01, 0.19, 0.3]
}
df1 = pd.DataFrame(data=d1)
I know how groupby y_pred column, but I can only groupby y_true manually, row-by-row

