transformgroupby

The full problem statement is available to Pro members.

preloaded fixtures

import pandas as pd
import numpy as np

plays = pd.DataFrame({
    "play_id": range(1, 13),
    "user": ["u1", "u1", "u2", "u2", "u3", "u1", "u4", "u2", "u3", "u1", "u2", "u4"],
    "artist": ["Nova Wave", "Nova Wave", "Nova Wave", "Maren Cruz", "The Quiet Hours", "Nova Wave",
               "Maren Cruz", "Basement Theory", "The Quiet Hours", "Maren Cruz", "Nova Wave", "Nova Wave"],
    "played_on": pd.to_datetime(["2024-01-05", "2024-01-05", "2024-01-06", "2024-01-06", "2024-01-07",
                                  "2024-01-08", "2024-01-09", "2024-01-10", "2024-01-11", "2024-02-01",
                                  "2024-02-02", "2024-02-03"]),
    "ms_played": [215000, 50000, 200000, 196000, 240000, 215000, 100000, 178000, 300000, 196000, 215000, 215000],
})

Guest mode · solve history stays on this device; code isn’t saved. Sign in to save future work

Pro problem

“Skip rate per user”

This is one of the real interview questions in Pro. Try Pro free for 7 days to unlock it and everything below:

  • 293 interview-grade problems across SQL, Python & pandas
  • 104+ real-world SQL problems: SaaS retention, fintech ledgers, supply chain, recursive CTEs
  • 18 company interview packs (Amazon, Meta, Google, Uber and more)
  • AI "explain my mistake" tutor and mock interviews
  • Use QueryLab inside Claude, Cursor & other AI assistants

// built for real interview rounds

Practice the patterns 18 top companies test

329 problems · 36 free forever · 293 unlocked with Pro

Card required. Then $12/month. Cancel before your trial ends and you pay nothing.

or keep practicing free problems →

Secure checkout by Paddle · instant access · cancel anytime from your account