I have a dataframe of all NBA players, their team and their points per game. I want to create a new data frame listing team names as the first column, and the next five columns are the pts per game of their five leading scorers.
so... (made up numbers)
ATL 17.2 14.3 12.2 10.2 9.4
I'm trying to work through what might get me there. I'm thinking I need to create subsets of the first data frame for each team (listing each of their scorers), then sort all 30 data frames and then move the first 5 values in the pts per game column into a new data frame using [0:4].
Is there an easy way to use a for loop to create all 30 data frames? Maybe if I created a list for each team name and then did something like....
for i in list:
create data frame i from ALLPLAYERS[TEAM = i]
Then I could use some other sort to sort them and add them into the final data frame.
Sorry, I know the "code" portion above isn't really the code, it's just what I'm thinking, I need to find the exact wording.