I have a pandas DataFrame like so
week player_a player_b
1 True True
1 True False
1 False False
2 False True
2 False False
2 True False
and I would like to count the number of True and False for each player by week, but I cannot seem to finagle this into a convenient pandas groupby or pivot table operation. The desired result would look like:
week True False
player
1 player_a 2 1
player_b 1 2
2 player_a 1 2
player_b 1 2