AnalystPath

Rank the App Leaderboard

PandasEasyJunior level~10 min

Problem

You are given a DataFrame `leaderboard` (loaded from `leaderboard.csv`) describing games on an app store, with columns `title`, `five_star`, `four_star`, and `three_star` holding the count of reviews at each star rating.

Return the rows sorted by `five_star` descending, then `four_star` descending, then `three_star` descending, and finally `title` ascending to break any remaining ties. The output columns must be `title`, `five_star`, `four_star`, `three_star`.

Input data

Example rows — the live problem includes the full dataset.

leaderboard
titlefive_starfour_starthree_star
Skyforge101020
Tidepool001
Aether Run101020
Mossgarden223
Pixel Forge222

Expected output

Your answer should return 5 rows with the columns title, five_star, four_star, three_star.

Starter code (Pandas (Python))

import pandas as pd

def rank_the_app_leaderboard(leaderboard) -> pd.DataFrame:
    # Your code here
    return leaderboard

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