Для следующей таблицы:
![enter image description here](https://i.stack.imgur.com/0oP9t.png)
I would like to use the groupby function with 'number_of_horses' and show a count for the 'TRUE' values in the 'winner' column.
Using Python-Pandas, I have tried:
INPUT:
df.groupby('number_of_horses').winner.count()
ВЫХОД:
![enter image description here](https://i.stack.imgur.com/zfb0b.png)
The table above is not the desired output.
The desired output is:
введите описание изображения здесь
Обратите внимание, что столбец «Победитель» засчитывается, только если значение TRUE.