Interview's MateData Science
Interview's Mate

Data Science

Python → ML → MLOps

Visualizer

DSA Visualizer
All 32 lessons
Custom Playground
Try your own examples

Learning

System Design
31 architecture topics
SQL Learning
160 foundations → production topics
AI Engineering
160 LLM → backend topics
Data Science
160 Python → MLOps topics
Data Engineer
160 SQL → streaming topics
Docker
160 Docker learning topics
Kubernetes
160 K8s fundamentals → cloud
Java LearnSoon
Coming soon
Python Learn
Interview Q&A & internals
JavaScript Learn
Closures, async & DOM Q&A
Tech Learn
Search, practise & track Q&A
AI DSA Practice
Solve coding problems
Theme
Home
Data Science topics
Lesson 75/ 160
04. Data Visualization & BI

Cohort & Funnel Analysis Charts

Visualize retention cohorts and conversion funnels that product and growth teams trust.

IntermediateCohorts · Funnels3 quiz questions
Practice Generative AI Q&A
In plain wordsDiagramTheoryStep by stepWhen to use itInterview cluesMistakes to avoidQuiz (3)Practice

In plain words

A cohort chart tracks groups of users who joined at the same time to see how many stay; a funnel shows how many make it through each step.

Think of it like…

Following school year-groups through the grades: instead of counting how many pupils are in the building, you track each intake and see what fraction graduates, and where in the pipeline (year 1, year 2, ...) they drop out.

Where you’ve seen it

January's cohort of 1,000 signups retains 100% in week 0, 42% in week 1, 28% in week 4, 24% in week 8 and 23% in week 12, so retention flattens near 23%. February's cohort, after an onboarding change, shows 33% at week 4 (+5 points). A paid-channel test cell inside it has only 40 users, and its 25% retention carries a 95% interval of ±13 points (SE = √(0.25 × 0.75 / 40) = 0.069), too wide to read on its own. In the funnel, 10,000 visits lead to 1,800 signups (18%), 900 activations (50% of signups, 9% overall) and 135 paid conversions (15% of activations, 1.35% overall). The largest absolute loss is visit to signup (8,200 users), but the activation step at 50% is the most fixable by product work, so the team tests a shorter onboarding there.

Words you’ll hear

Cohort
A group of users defined by a shared start event and period.
Retention curve
Share of a cohort still active at each period after the start.
Step vs overall conversion
Conversion from the previous funnel step versus from the first step.
Right-censoring
Recent cohorts haven't had time to reach later periods, so those cells are unknown, not zero.

Visual diagram

Loading interactive diagram

Theory & deep dive

Building and reading cohort charts

Define the cohort (signup week or month, first purchase date, acquisition channel) and the activity that counts as retained (any login, a core action such as placing an order). In pandas: assign each user a cohort and compute period = activity_period - cohort, then pivot = df.pivot_table(index="cohort", columns="period", values="user_id", aggfunc="nunique") and divide each row by its period-0 size with pivot.div(pivot[0], axis=0). Plot with sns.heatmap(retention, annot=True, fmt=".0%", cmap="Blues"), using a sequential palette because values are ordered. Mask cells for periods that haven't elapsed yet: they are right-censored (unknown), not zero, and drawing them as zero makes recent cohorts look terrible.

Read three patterns: down the rows (are newer cohorts retaining better or worse at the same age? That reveals product or acquisition changes), across a row (the shape of the curve: steep early drop then plateau indicates a core of engaged users; a curve that keeps falling to zero signals no lasting value), and diagonals (calendar events such as a pricing change or outage that hit all cohorts at once). Choose the retention definition deliberately: classic (active exactly on day or week N), rolling or unbounded (active on or after N), or bracket (active within a window); they give different numbers. For revenue, track cumulative revenue per original user by cohort to estimate payback and lifetime value.

Reading a row

January cohort: 100%, 42%, 28%, 24%, 23% at weeks 0, 1, 4, 8, 12. The steepest loss is in week 1 (58 points), and the curve flattens near 23% after week 8, suggesting onboarding is the lever and a stable core remains. A cohort that kept falling past week 12 would indicate no durable habit.

Key takeaway: Pivot by cohort and age, mask unelapsed periods, and read down rows, across rows and along diagonals.

Funnels, segmentation and statistical care

A funnel needs an ordered list of steps and a conversion window (for example, purchase within 7 days of signup), and a decision on whether steps must occur in order. Report both step conversion (activation 900 / signups 1,800 = 50%; paid 135 / 900 = 15%) and overall conversion (135 / 10,000 = 1.35%), plus absolute counts. Draw it as horizontal bars of equal height with the counts and conversions labelled, not as a 3D funnel shape whose geometry encodes nothing. Prioritise by both size of the leak and tractability: the largest absolute drop (visit to signup, 8,200 users) may be mostly low-intent traffic, while a 50% activation step may be a bigger product opportunity. Add time to convert distributions to see where users stall.

Slice every funnel and cohort by segment (channel, device, plan, country), but beware Simpson's paradox and mix shifts: overall conversion can improve because the share of a high-converting segment grew, while every segment is unchanged. Small cohorts are noisy: with n = 40 and p = 0.25 the 95% interval is ±13 points, so don't read differences of a few points between tiny cohorts as findings; show cohort sizes next to each row and use intervals or pooled comparisons. Also watch for survivorship bias (only counting users who stayed), duplicate or merged identities that inflate retention and bot traffic that depresses top-of-funnel conversion. Validate with an experiment before crediting a product change for a cohort improvement.

Funnel arithmetic

10,000 visits → 1,800 signups (18%) → 900 activations (50% of signups, 9% of visits) → 135 paid (15% of activations, 1.35% of visits). Raising activation from 50% to 60% yields 1,080 activations and 162 paid users, +27 paid users with no extra traffic.

Key takeaway: Report step and overall conversion with counts, slice by segment with care and respect small-sample noise.

How it works, step by step

Step 1 of 4
Analyst

1. Define cohort and activity

Choose the cohort start event, the period grain and the activity that counts as retained.

signup week · placed an order
Key numbers at this step
Document
retention definition

When to use it & trade-offs

What it is

Cohort analysis groups users by a shared starting event (signup month, first purchase) and tracks what share of each group is still active after 1, 2, 3, ... periods. It is usually drawn as a retention heatmap (rows are cohorts, columns are periods since signup, cells are percentages) or as retention curves (one line per cohort). Funnel analysis counts how many users reach each successive step of a process (visit, signup, activation, purchase) and reports step conversion (to the previous step) and overall conversion (to the first step). Together they show whether a product keeps users and where it loses them, without the distortions that blended calendar-time averages produce.

Why it matters: Aggregate metrics like monthly active users can rise while every new cohort retains worse than the last, simply because acquisition spend increased. Cohorts separate "who joined when" from "what happens after joining", so you can tell whether a product change helped, and funnels pinpoint the stage with the biggest leak. Product, growth and finance teams use these charts to decide what to fix and how much a user is worth.

When to reach for it

  • Judging whether product changes improved retention
  • Prioritising funnel steps for experiments
  • Estimating payback and lifetime value by cohort

When to avoid or be careful

  • Treating unelapsed periods as zero retention
  • Reading small differences between tiny cohorts
  • 3D funnel graphics with no data meaning

Retention and conversion views

Retention heatmap
Best for: Comparing many cohorts at the same age

Strengths: Shows trends across cohorts at a glance.

Watch out: Hard to read exact curve shapes.

Retention curves
Best for: Shape and plateau of a few cohorts

Strengths: Clear on decay and flattening.

Watch out: Cluttered with many cohorts.

Funnel bars
Best for: Finding where users drop in a process

Strengths: Pinpoints leaks with counts and rates.

Watch out: Ignores returning later; needs a conversion window.

Interview signals & numbers to know

When this topic comes up

  • “MAU is up but are users sticking?”
  • “Where do users drop off?”
  • Retention heatmap
  • Conversion window
  • Right-censored cohorts

Benchmarks & rules of thumb

18% → 50% → 15% -
step conversions in the example funnel
1.35% -
overall visit-to-paid conversion
±13 pts -
95% interval for 25% retention with n = 40

Common mistakes & follow-ups

Common interview mistakes

  • Comparing cohorts at different ages.
  • Quoting overall conversion without step-level counts.
  • Crediting a feature for a cohort improvement caused by a channel mix shift.

Likely interviewer follow-ups

  • How would you build a retention table in pandas?
  • Why do immature cohorts need masking?
  • How would you decide which funnel step to improve first?
Interview tip: Show both step and overall conversion with absolute counts. It makes the leak size and the opportunity obvious in one line.

Knowledge check

Loading quiz

Put it into practice

Practice related interview Q&A

Apply Cohort & Funnel Analysis Charts with data science interview Q&A and hands-on practice.

Open Data Science Q&A →Machine Learning Q&A
Previous topic
Avoiding Misleading Visuals & Chartjunk
Next topic
Time-Series & Trend Visualization