Purchase Events

Easy
Filtering
Amazon
Meta

Purchase Events

Given events, return rows where event_type = 'purchase'. Project event_id, user_id, platform and order by event_id ascending.

Sample input

event_iduser_idevent_typeplatform
16viewWeb
213logoutiOS
316viewWeb
47clickAndroid
517viewAndroid
612clickiOS
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.events10 rows
event_id (int)user_id (int)event_type (string)platform (string)
16viewWeb
213logoutiOS
316viewWeb
47clickAndroid
517viewAndroid
612clickiOS
78viewiOS
818clickWeb
911clickAndroid
1020signupWeb

Return these columns

event_id(int)
user_id(int)
platform(string)

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.