AnalystPath

Esports Ladder Standings by Split

PandasMediumMid level~10 min

Problem

A competitive gaming league hands you a DataFrame `split_results`, one row per roster's end-of-split record. A win is worth 3 ladder points and a draw is worth 1; losses are worth 0. Rank rosters within each split by, in order: ladder points (highest first), then round_diff = rounds_won minus rounds_lost (highest first), then roster_name alphabetically. Use a ranking that gives tied rows the same standing (so the next standing skips the gap). Return a DataFrame with columns split_id, roster_id, roster_name, victories, stalemates, defeats, rounds_won, rounds_lost and standing, ordered by split_id, then standing, then roster_name.

Input data

Example rows — the live problem includes the full dataset.

split_results
split_idroster_idroster_namegames_playedvictoriesstalematesdefeatsrounds_wonrounds_lost
20211Nova Surge3829639926
20212Iron Wolves3828829426
20213Crimson Edge38211167633
20214Tidal Kings38225116940
20215Apex Falcons38223136148

Expected output

Your answer should return 10 rows with the columns split_id, roster_id, roster_name, victories, stalemates, defeats, rounds_won, rounds_lost, standing.

Starter code (Pandas (Python))

import pandas as pd

def esports_ladder_standings_by_split(split_results) -> pd.DataFrame:
    # Your code here
    return split_results

Solve 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

Related Pandas questions