Chess Club Ladder Standings
Problem
You are given two DataFrames. `clubs` (from `clubs.csv`) has columns `club_id` and `club_name`. `bouts` (from `bouts.csv`) has columns `bout_id`, `white_club`, `black_club`, `white_wins`, and `black_wins`; each row is a team match where the two clubs played White and Black and won the listed number of boards.
Score each club across all bouts: a club earns **3 points** for winning a bout (more boards won than the opponent), **1 point** for a tie, and **0 points** for a loss. A club that played no bouts has 0 points. Return `club_id`, `club_name`, and `standing_points`, sorted by `standing_points` descending, then `club_id` ascending.
Input data
Example rows — the live problem includes the full dataset.
| club_id | club_name |
|---|---|
| 10 | Knight Owls |
| 20 | Rook Riders |
| 30 | Bishop Brigade |
| 40 | Pawn Stars |
| 50 | Castle Crew |
| bout_id | white_club | black_club | white_wins | black_wins |
|---|---|---|---|---|
| 1 | 10 | 20 | 3 | 0 |
| 2 | 30 | 10 | 2 | 2 |
| 3 | 10 | 50 | 5 | 1 |
| 4 | 20 | 30 | 1 | 0 |
| 5 | 50 | 30 | 1 | 0 |
Expected output
Your answer should return 5 rows with the columns club_id, club_name, standing_points.
Starter code (Pandas (Python))
import pandas as pd
def ladder_standings(clubs, bouts) -> pd.DataFrame:
# Your code here
return clubsSolve this Pandas question free
Write Pandas (Python) and run it instantly in your browser — even on your phone. No signup needed to try.
Solution & explanation
Create a free account to unlock the optimal solution, a step-by-step explanation, and the hidden test cases that grade your answer.
Sign up free to unlock