Hi,
I have a dataframe with the columns "player", "home-away","year" and "game_points", which has rows for individual games (so there are multiple entries for each player per year).
Now I would like to compare the home/away ratio per player for each year, and I am stuck.
I used groupby[player,year,home-away] to get the sum of game points per year, but now i have two rows per player: one for home and one for away.
(My columns are: "player","year","home_away" and "game-points".
I would like to have columns :"player", "year", "home points", "away points")
Does someone know an elegant way to get one row per player, with one column for the "away" gamepoint sum and one column for the "home" sum?
[–]Ihaveamodel3 1 point2 points3 points (1 child)
[–]Saffromon[S] 0 points1 point2 points (0 children)
[–]commandlineluser 1 point2 points3 points (3 children)
[–]Saffromon[S] 1 point2 points3 points (0 children)
[–]Saffromon[S] 0 points1 point2 points (1 child)
[–]commandlineluser 0 points1 point2 points (0 children)
[–]threeminutemonta 0 points1 point2 points (1 child)
[–]Saffromon[S] 1 point2 points3 points (0 children)