I have been banging my head against a wall for a while now trying to figure out this seemingly easy data manipulation task in Pandas, however I have had no success figuring out how to do it or googling a sufficient answer :(
All I want to do is take the table on the left of the snip below (will be a pandas dataframe) and convert it into the table on the right (to become another pandas dataframe).
Code for creating the initial dataframe:
import pandas as pd
test_data = pd.DataFrame(
{
'team': [1,1,2,2,3,3,4,4,5,5] ,
'player': ['a','b','c','d','e','f','g','h','i','j'] ,
'score': [10,22,66,44,1,3,55,6,4,2]
}
)
Thank you for your help in advance!
