all problems

Cost per tenant PRO

pandaseasyassigngroupby

The full problem statement is available to Pro members.

preloaded fixtures

import pandas as pd
import numpy as np

meters = pd.DataFrame({
    "tenant": ["Acme", "Acme", "Globex", "Initech", "Initech", "Hooli", "Hooli", "Globex"],
    "service": ["Compute", "Storage", "Compute", "Compute", "Storage", "Compute", "Bandwidth", "Bandwidth"],
    "day": ["2024-03-01", "2024-03-01", "2024-03-01", "2024-03-02", "2024-03-04", "2024-03-06", "2024-03-07", "2024-03-03"],
    "quantity": [120.0, 5000.0, 30.0, 260.0, 12000.0, 410.0, 2200.0, 800.0],
    "unit_cost": [0.12, 0.002, 0.12, 0.12, 0.002, 0.12, 0.008, 0.008],
})
meters["day"] = pd.to_datetime(meters["day"])

seats = pd.DataFrame({
    "tenant": ["Acme", "Acme", "Globex", "Initech", "Hooli", "Hooli"],
    "product": ["M365 E5", "Power BI", "M365 E3", "M365 E5", "M365 E5", "Power BI"],
    "seats": [700, 200, 120, 450, 1000, 300],
    "status": ["active", "active", "churned", "active", "active", "active"],
})

This is a Pro problem

“Cost per tenant” 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.