Cohort analysis visualization

Customer Segmentation in Python

Karolis Urbonas

Head of Data Science, Amazon

Heatmap

  • Easiest way to visualize cohort analysis

  • Includes both data and visuals

  • Only few lines of code with seaborn

cohort_heatmap

Customer Segmentation in Python

Load the retention table

retention.round(3)*100

retention_table

Customer Segmentation in Python

Build the heatmap

import seaborn as sns
import matplotlib.pyplot as plt

plt.figure(figsize=(10, 8))
plt.title('Retention rates')
sns.heatmap(data = retention, annot = True, fmt = '.0%', vmin = 0.0, vmax = 0.5, cmap = 'BuGn')
plt.show()
Customer Segmentation in Python

Retention heatmap

retention_heatmap

Customer Segmentation in Python

Practice visualizing cohorts

Customer Segmentation in Python

Preparing Video For Download...