all problems

Top spender per country PRO

pandasmediumgroupbyidxmax

The full problem statement is available to Pro members.

preloaded fixtures

import pandas as pd
import numpy as np

usage = pd.DataFrame({
    "user_id": [1, 1, 2, 2, 3, 3, 4, 4, 5, 5],
    "app": ["FitTrack", "FitTrack", "PixelQuest", "PixelQuest", "NoteVault", "FitTrack", "PixelQuest", "MindCalm", "BudgetBee", "BudgetBee"],
    "day": ["2024-03-01", "2024-03-02", "2024-03-01", "2024-03-03", "2024-03-02", "2024-03-04", "2024-03-02", "2024-03-05", "2024-03-01", "2024-03-06"],
    "minutes": [22, 14, 65, 40, 11, 30, 9, 25, 7, 18],
    "crashes": [0, 1, 2, 0, 0, 0, 3, 1, 0, 0],
})
usage["day"] = pd.to_datetime(usage["day"])

receipts = pd.DataFrame({
    "user_id": [1, 1, 2, 3, 4, 5, 5, 6],
    "app": ["FitTrack", "PixelQuest", "PixelQuest", "NoteVault", "FitTrack", "BudgetBee", "PixelQuest", "MindCalm"],
    "amount": [9.99, 4.99, 19.99, 2.99, 9.99, 6.00, 14.99, 12.50],
    "country": ["USA", "USA", "UK", "USA", "Germany", "USA", "USA", "UK"],
})

This is a Pro problem

“Top spender per country” 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.