I have a pandas Dataframe that has been grouped into a multi-index, and it basically groups the stats by game id, having the level 2 index be the team's id. I am using this data for machine learning and need the stats to be on the same row, where the column name will be joined by either team1 or team1, as in team1.pts and team2.pts. Is this possible in any convenient way?
Thank you so much for the help, I attached a screenshot of the dataframe in case I did a horrible job of explaining this.
EDIT:
For a better way to explain this, every consecutive row should be joined with the row above it, to sort of flatten the dataframe to half the amount of rows and double the amount of columns.