0Pricing
Pandas & NumPy Academy · 강의

사용자 여정 시각화

퍼널은 가로 막대 그래프로, 유지율 행렬은 히트맵으로 그려 이해관계자에게 결과를 전달합니다.

사용자 여정 시각화은(는) CoddyKit의 무료 Pandas & NumPy Academy 강의입니다. 이것은 4개 중 4번째 강의입니다. 아래에서 전체 강의를 무료로 읽을 수 있으며, 내장 코드 에디터와 24/7 AI 튜터와 함께 브라우저에서 직접 실습할 수 있습니다. 이 강의는 Pandas & NumPy Academy 학습 경로의 일부이며, 진행 상황이 웹과 CoddyKit 앱에 동기화됩니다. Pandas & NumPy Academy 강의에는 총 4개의 강의가 포함되어 있습니다.

이 강의의 일부는 아직 번역되지 않았으며 영어로 표시됩니다.

Why Visualise User Journeys?

Raw event tables and conversion rates as numbers are hard to communicate to non-technical stakeholders. Visual representations of user journeys — funnel charts, retention heatmaps, and Sankey diagrams — make patterns immediately apparent. The goal is not to replace the numbers but to present them in a form where insights are self-evident at a glance, reducing the cognitive load on the audience.

import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns

# Assume funnel_summary and retention_pct are already computed
print('Visualisation libraries loaded')

Horizontal Bar Chart for Funnel

A horizontal bar chart is the simplest and most widely understood funnel visualisation. Each bar represents a funnel step; bar length represents the user count. Sort steps from top to bottom in funnel order so the chart reads as a widening funnel. Use a single contrasting colour for all bars so attention stays on the values, not the colour variety.

FUNNEL_STEPS = ['homepage', 'product_page', 'add_to_cart', 'checkout', 'purchase']
users = [10000, 7200, 4100, 2300, 980]

fig, ax = plt.subplots(figsize=(9, 5))
bars = ax.barh(FUNNEL_STEPS[::-1], users[::-1], color='steelblue', height=0.6)
ax.set_xlabel('Unique Users')
ax.set_title('Conversion Funnel')
plt.tight_layout()
plt.show()

Annotating Conversion Rates on the Chart

Add conversion rate annotations at the right edge of each bar using ax.text(). Show both the absolute user count and the step-to-step conversion percentage so the chart communicates everything needed without a separate data table. Position the text slightly outside the bar end with a small horizontal offset so it does not overlap the bar fill colour.

conversions = [None, 72.0, 56.9, 56.1, 42.6]

for i, (u, c) in enumerate(zip(users[::-1], conversions[::-1])):
    label = f'{u:,} users'
    if c is not None:
        label += f'  ({c}% conv)'
    ax.text(u + 100, i, label, va='center', fontsize=9)

plt.tight_layout()
plt.show()

Retention Heatmap Revisited

The retention heatmap is the standard output of cohort analysis. Each row is a cohort, each column is a week offset, and each cell is coloured by retention percentage. Use the RdYlGn colormap (red = low, green = high) with explicit vmin=0, vmax=100 so the colour scale is consistent across presentations and does not rescale per heatmap.

import numpy as np

# Simulated retention data for illustration
data = [[100, 55, 42, 38, 35, 33],
        [100, 52, 40, 36, 33, 0],
        [100, 58, 45, 41, 0, 0],
        [100, 60, 48, 0, 0, 0]]
retention_pct = pd.DataFrame(data, columns=range(6),
                             index=['Wk1', 'Wk2', 'Wk3', 'Wk4'])

fig, ax = plt.subplots(figsize=(10, 4))
sns.heatmap(retention_pct, annot=True, fmt='.0f', cmap='RdYlGn',
            vmin=0, vmax=100, linewidths=0.5, ax=ax)
ax.set_title('Cohort Retention Heatmap')
plt.tight_layout()
plt.show()

Masking Incomplete Cohort Cells

Newer cohorts have not yet had time to complete all week offsets. Those cells should appear blank rather than as 0 % so readers do not mistake absent data for zero retention. Create a boolean mask where the cell value is 0 and the column index exceeds the number of weeks the cohort has existed, then pass it to sns.heatmap(mask=...).

mask = retention_pct == 0  # cells with no data yet

fig, ax = plt.subplots(figsize=(10, 4))
sns.heatmap(retention_pct, annot=True, fmt='.0f', cmap='RdYlGn',
            vmin=0, vmax=100, linewidths=0.5,
            mask=mask, ax=ax)
ax.set_title('Cohort Retention (incomplete cells masked)')
plt.tight_layout()
plt.show()

Plotting the Average Retention Curve

Visualise the average retention curve by plotting the column means of the retention matrix. This single line summarises the overall product retention profile. Add a shaded band for ±1 standard deviation to show cohort variability. A narrow band means cohorts behave similarly; a wide band suggests important cohort-level differences worth investigating.

avg = retention_pct.mean(axis=0)
std = retention_pct.std(axis=0)

fig, ax = plt.subplots(figsize=(8, 4))
ax.plot(avg.index, avg, marker='o', color='steelblue', linewidth=2)
ax.fill_between(avg.index, avg - std, avg + std, alpha=0.2, color='steelblue')
ax.set_xlabel('Week Number')
ax.set_ylabel('Avg Retention %')
ax.set_title('Average Cohort Retention Curve')
plt.tight_layout()
plt.show()

Segmented Funnel: Desktop vs. Mobile

Plotting funnels for different segments side by side reveals whether product problems are global or device-specific. Create a grouped bar chart with two bar groups per funnel step using ax.bar() with an x-offset. Alternatively, draw two separate funnel charts in a 1×2 subplot grid using plt.subplots(1, 2) for cleaner comparison.

steps = ['Homepage', 'Product', 'Cart', 'Checkout', 'Purchase']
desktop = [5000, 3800, 2300, 1500, 700]
mobile = [5000, 3400, 1800, 900, 280]

x = range(len(steps))
fig, ax = plt.subplots(figsize=(10, 5))
ax.bar([i - 0.2 for i in x], desktop, width=0.4, label='Desktop', color='steelblue')
ax.bar([i + 0.2 for i in x], mobile, width=0.4, label='Mobile', color='darkorange')
ax.set_xticks(list(x))
ax.set_xticklabels(steps)
ax.legend()
ax.set_title('Funnel by Device Type')
plt.tight_layout()
plt.show()

Event Frequency Distribution

Visualising the distribution of events per session shows whether sessions cluster around a small number of events (suggesting users achieve their goal quickly) or span a wide range (suggesting complex journeys or confusion). Plot with ax.hist() on the event_count column, using a log scale on the y-axis if the distribution is highly right-skewed.

import numpy as np

event_counts = pd.Series([3, 5, 2, 8, 1, 12, 3, 4, 6, 20, 2, 3, 1, 7, 5])

fig, ax = plt.subplots(figsize=(8, 4))
ax.hist(event_counts, bins=15, color='steelblue', edgecolor='white')
ax.set_xlabel('Events per Session')
ax.set_ylabel('Number of Sessions')
ax.set_title('Session Event Frequency Distribution')
plt.tight_layout()
plt.show()

Top Event Sequences

Show the most common two-event sequences (bigrams) in the clickstream to understand typical user paths. Group by session, sort by event_rank, and extract consecutive pairs using zip(events, events[1:]). Count pair frequencies with a Counter and plot the top 10 as a horizontal bar chart. This reveals which navigation paths dominate user behaviour.

from collections import Counter

events_per_session = [['homepage', 'product_page', 'add_to_cart'],
                       ['homepage', 'search', 'product_page'],
                       ['homepage', 'product_page', 'purchase']]

bigrams = Counter()
for session in events_per_session:
    for pair in zip(session, session[1:]):
        bigrams[pair] += 1

print(bigrams.most_common(5))

Session Duration Distribution

A histogram of session durations reveals whether users engage briefly (under 2 minutes), moderately, or deeply. Use a log-scale x-axis if a small number of very long sessions would compress the bulk of data into the leftmost bin. Overlay a vertical line at the median with ax.axvline() to anchor the audience's interpretation of 'typical' session length.

durations = pd.Series([1.2, 3.5, 0.5, 12.3, 2.1, 8.7, 1.8, 0.3, 45.1, 4.6])

fig, ax = plt.subplots(figsize=(8, 4))
ax.hist(durations, bins=20, color='steelblue', edgecolor='white')
ax.axvline(durations.median(), color='red', linestyle='--', label=f'Median: {durations.median():.1f} min')
ax.set_xlabel('Session Duration (min)')
ax.set_ylabel('Sessions')
ax.legend()
plt.tight_layout()
plt.show()

Saving the Dashboard Figure

Combine multiple visualisations into a single dashboard figure using a grid of subplots with plt.subplots(2, 2, figsize=(14, 10)). Assign the funnel bar chart, retention heatmap, average retention curve, and event distribution to each panel. Save to PNG for web delivery or to PDF for printable reports. A unified figure is easier to share than four separate files.

fig, axes = plt.subplots(2, 2, figsize=(14, 10))

# Panel 1: funnel
axes[0, 0].barh(FUNNEL_STEPS[::-1], users[::-1], color='steelblue')
axes[0, 0].set_title('Funnel')

# Panel 2: retention heatmap
sns.heatmap(retention_pct, ax=axes[0, 1], cmap='RdYlGn', annot=True, fmt='.0f', vmin=0, vmax=100)
axes[0, 1].set_title('Cohort Retention')

fig.suptitle('User Journey Dashboard', fontsize=16)
plt.tight_layout()
fig.savefig('user_journey_dashboard.png', dpi=150, bbox_inches='tight')
print('Dashboard saved')

Quick Check

Test your understanding of Data Analysis concepts from this lesson.

Lesson Recap

In this lesson you learned: creating annotated funnel bar charts and retention heatmaps, plotting average retention curves with variability bands, and combining multiple charts into a single dashboard figure saved to PNG. Next up we explore detecting and removing duplicate records in advanced data cleaning.

자주 묻는 질문

“사용자 여정 시각화” 강의는 무료인가요?

네 — “사용자 여정 시각화” 전체 내용을 이 웹사이트에서 무료로 읽을 수 있습니다. 인터랙티브하게 실습하려면(내장 코드 에디터와 24/7 AI 튜터), CoddyKit PRO로 업그레이드하면 Pandas & NumPy Academy 강의 전체를 잠금 해제할 수 있습니다. Pandas & NumPy Academy 강의에는 총 4개의 강의가 포함되어 있습니다.

“사용자 여정 시각화”에서 뭘 배우나요?

퍼널은 가로 막대 그래프로, 유지율 행렬은 히트맵으로 그려 이해관계자에게 결과를 전달합니다. 브라우저에서 직접 실행하는 실습 코드로 Pandas & NumPy Academy을(를) 배우며, 24/7 AI 튜터가 강의를 진행하면서 질문에 답변해줍니다.

Pandas & NumPy Academy을(를) 시작하는 데 경험이 필요한가요?

사전 경험은 필요하지 않습니다. CoddyKit의 Pandas & NumPy Academy은(는) 초급자부터 고급 학습자까지를 위해 구성되어 있으므로, 여기서 시작하거나 처음부터 시작할 수 있으며 자신의 속도대로 진행할 수 있습니다. 이것은 4개 중 4번째 강의입니다.

“사용자 여정 시각화” 강의는 얼마나 걸리나요?

대부분의 CoddyKit 강의는 약 5~10분이 소요됩니다. 각 강의는 간결하고 인터랙티브하여 꾸준한 진행이 가능하며, 웹과 앱에서 중단한 부분부터 바로 시작할 수 있습니다.

이 Pandas & NumPy Academy 강의에서 코드를 작성하고 실행할 수 있나요?

네. 모든 Pandas & NumPy Academy 강의에는 내장 코드 에디터가 포함되어 있으므로, 브라우저에서 바로 실제 코드를 작성하고 실행한 후 즉시 AI 피드백을 받을 수 있습니다 — 로컬 설정이 필요 없습니다.

이 강의의 모든 강의

  1. 세션화와 이벤트 순서 지정
  2. 퍼널 분석
  3. 코호트 유지율 표
  4. 사용자 여정 시각화
← Pandas & NumPy Academy(으)로 돌아가기