

0 / 2 embers
0 / 3000 xp
click for more info
Complete a lesson to start your streak
click for more info
Difficulty: 4
click for more info
Not enough gems
Cost: 6 gems
1: Event Data
incomplete
2: Event Structure
incomplete
3: Event Counting
incomplete
4: Resample
incomplete
5: Resample Aggregations
incomplete
6: Active Users
incomplete
7: Time Patterns
incomplete
8: Funnel Metrics
incomplete
9: Conversion Rates
incomplete
10: Funnel Drop-Offs
incomplete
11: Ordered Funnels
incomplete
12: Cohorts
incomplete
13: Cohort Retention
incomplete
14: Rolling Metrics
incomplete
15: Growth Rates
incomplete
Back
ctrl+,
Next
ctrl+.
This lesson's interactive features are locked, please to keep using them
It's common to want to know when users are most active:
events["hour"] = events["timestamp"].dt.hour
hourly_activity = events.groupby("hour")["user_id"].nunique()
peak_hour = hourly_activity.idxmax()
The idxmax() method returns the index label for the largest value. I often use it to find when it's best to send notifications or when to schedule downtime maintenance (jk we never have downtime).
events["day_of_week"] = events["timestamp"].dt.dayofweek
dow_activity = events.groupby("day_of_week")["user_id"].nunique()
B2B products spike Monday-Friday. Consumer products often spike on weekends. If your pattern doesn't match expectations, investigate further!
SnackStack's marketing team wants to push recipe notifications at the hour when the most people are using their devices.
Complete the peak_activity_hour function. It accepts an events DataFrame with timestamp and user_id columns and returns the hour of day (0–23) with the most active users.