all problems

Engagement leaderboard PRO

pandasmediumaggmultiple metrics

The full problem statement is available to Pro members.

preloaded fixtures

import pandas as pd
import numpy as np

plays = pd.DataFrame({
    "video_id": [1, 1, 2, 2, 3, 3, 4, 5, 5, 6],
    "creator": ["@chefmina", "@chefmina", "@chefmina", "@chefmina", "@dancelab", "@dancelab", "@dancelab", "@petsdaily", "@petsdaily", "@petsdaily"],
    "duration_sec": [35, 35, 18, 18, 22, 22, 60, 90, 90, 15],
    "watched_sec": [35, 10, 18, 6, 22, 11, 20, 90, 45, 15],
    "liked": [1, 0, 1, 0, 1, 0, 0, 1, 1, 1],
})

gifts = pd.DataFrame({
    "creator": ["@chefmina", "@chefmina", "@dancelab", "@petsdaily", "@petsdaily", "@gymrat"],
    "day": ["2024-03-02", "2024-03-09", "2024-03-05", "2024-03-03", "2024-03-06", "2024-03-04"],
    "coins": [620, 250, 80, 2400, 600, 450],
})
gifts["day"] = pd.to_datetime(gifts["day"])

This is a Pro problem

“Engagement leaderboard” is part of the Pro problem set. Upgrade to unlock the harder half of every track — SQL, Python and pandas.

Upgrade to Pro

The first problems in each track stay free.