Whales: Users Spending Over 100

Medium
GroupBy
Aggregations
Filtering
Uber

Whales: Users Spending Over 100

Sum amount per user_id; keep only users whose total > 100.0. Return user_id, total (rounded to 2 decimals) sorted by user_id asc.

Browser Engine: Evaluates PySpark DataFrame & SQL logic locally in Pyodide WebAssembly.

Input data

1 DataFrame

These DataFrames are passed to solve(spark, dfs). Access one with dfs['name'].

df.orders20 rows
user_id (int)amount (double)
524.19
68.37
513.79
530.35
445.69
115.15
37.41
127.09
219.87
412.74
313.43
345.2
313.15
129.74
52.21
615.69
522.63
615.61
418.88
134.36

Return these columns

user_id(int)
total(double)

Column names and order must match. Sort order is specified in the question.

Browser engine
Loading Python editor…
Click Run to try the sample cases, or Submit to check the hidden cases. First run caches the browser Python engine (~8–15s once); all code stays on your device.