

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
Every click, signup, purchase, and page view on a website generates an event: a timestamped record that something happened. "Event-based analytics" means collecting all these user actions and analyzing them to understand how people actually use your product.
At every analytics job I've had, the event log was the single most valuable table in the warehouse. Everything else – dashboards, reports, ML features – was derived from it.
At minimum, "event" records include:
events = pd.DataFrame(
{
"timestamp": [
"2024-01-15 09:23:11",
"2024-01-15 09:24:05",
"2024-01-15 10:01:33",
],
"user_id": [101, 101, 202],
"event_type": ["page_view", "signup", "login"],
}
)
events["timestamp"] = pd.to_datetime(events["timestamp"])
The DataFrame stores the event log, and pd.to_datetime() turns timestamp strings into real datetime values.
Pre-aggregated metrics (like "total signups this month") are great for final reports, but impossible to investigate. When the number of signups drops, you want to know: which user segments are affected? Which marketing channels are underperforming? Are there any time-based patterns?
Raw events give you flexibility. You can slice by user segment, time window, device, or any property attached to the event. The tradeoff is that you need to do the aggregation yourself – which is exactly what pandas is good at.
Make sure timestamp columns are always parsed as a datetime with pd.to_datetime() before doing any time-based analysis.