Unique Visitors Per Page

Easy
Aggregations
GroupBy
Meta
Razorpay

Unique Visitors Per Page

Count distinct user_id per page and return as unique_users. Sort by page asc.

Sample input

event_iduser_idpage
13pdp
21home
34search
42home
54cart
62search
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.events15 rows
event_id (int)user_id (int)page (string)
13pdp
21home
34search
42home
54cart
62search
73home
83home
95search
103pdp
115home
123search
133search
142cart
151home

Return these columns

page(string)
unique_users(long)

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.