Latest Row per Player
games has columns player and score, and rows are in the order they were played. Return a DataFrame that keeps only the last row of each player, with the rows in their original order.
Example 1
games {"player":["ann","bob","ann"],"score":[5,7,9]}
returns {"columns":["player","score"],"rows":[["bob",7],["ann",9]]}
Ann's first row is dropped.
Constraints
- The tables are small
Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.
More pandas problems
- Longest TitleEasy
- Make SlugsEasy
- Median per GroupEasy
- Moving Sum of ThreeEasy
- Names Starting WithEasy
- Normalize ScoresEasy
- Not Boring MoviesEasy
- Nth Highest SalaryEasy