Next cohort starts January 9.Apply ›

Peloton · Data Analytics

Customer Churn Analysis

The work

  1. 1. Exploratory Data Analysis (EDA)

    In this section, we perform Exploratory Data Analysis (EDA) on the cleaned subscriptions and usage datasets.

    The objective is to understand customer characteristics, subscription behaviour, engagement patterns, and potential factors associated with customer churn.

    Analysis Objectives

    • Understand the overall customer distribution.
    • Calculate the overall customer churn rate.
    • Explore subscription plan types and tiers.
    • Analyze customer demographics and acquisition channels.
    • Understand customer engagement patterns.
    • Examine customer tenure and cancellation behaviour.
    • Identify potential relationships between customer activity and churn.

    Datasets Used

    1. subscriptions_clean.csv – Contains customer subscription details, demographics, plan information, and cancellation status.
    2. usage_clean.csv – Contains monthly customer engagement information, including workouts, active minutes, classes booked, and support tickets.

    The findings from this analysis will help identify potential churn drivers and support evidence-based business recommendations.

  2. #loading libraries
    import pandas as pd
    import numpy as np
    import matplotlib.pyplot as plt
    import seaborn as sns
    
    sns.set_theme(style="whitegrid")
  3. subscriptions = pd.read_csv(
        "../data/cleaned/subscriptions_clean.csv",
        parse_dates=["signup_date", "churn_date"]
    )
    
    usage = pd.read_csv(
        "../data/cleaned/usage_clean.csv",
        parse_dates=["month"]
    )
  4. print("SUBSCRIPTIONS DATASET")
    print(subscriptions.shape)
    
    print("\nUSAGE DATASET")
    print(usage.shape)
    SUBSCRIPTIONS DATASET
    (4200, 11)
    
    USAGE DATASET
    (30525, 6)
    
  5. subscriptions.head()
       customer_id signup_date plan_type plan_tier  monthly_price  \
    0            1  2024-09-11   monthly     basic          12.99   
    1            2  2025-08-14    annual     basic           9.74   
    2            3  2025-01-24   monthly     basic          12.99   
    3            4  2024-08-15   monthly     basic          12.99   
    4            5  2025-06-24    annual      plus          14.99   
    
      acquisition_channel primary_device age_group churned churn_date  \
    0         promo_offer        android     45-54     yes 2025-06-29   
    1         promo_offer            web     45-54      no        NaT   
    2            referral            ios       55+      no        NaT   
    3         paid_social            ios     25-34     yes 2024-08-20   
    4         paid_social        android       55+      no        NaT   
    
          cancel_reason  
    0  technical_issues  
    1    not_applicable  
    2    not_applicable  
    3  not_using_enough  
    4    not_applicable  
  6. usage.head()
       customer_id      month  workouts_completed  minutes_active  classes_booked  \
    0            1 2024-09-01                   5           140.0               0   
    1            1 2024-10-01                   4           116.0               0   
    2            1 2024-11-01                   7           208.0               0   
    3            1 2024-12-01                   5           109.0               0   
    4            1 2025-01-01                   1            41.0               0   
    
       support_tickets  
    0                0  
    1                0  
    2                0  
    3                0  
    4                0  
  7. subscriptions.info()
    
    print("\n")
    
    usage.info()
    <class 'pandas.core.frame.DataFrame'>
    RangeIndex: 4200 entries, 0 to 4199
    Data columns (total 11 columns):
     #   Column               Non-Null Count  Dtype         
    ---  ------               --------------  -----         
     0   customer_id          4200 non-null   int64         
     1   signup_date          4200 non-null   datetime64[ns]
     2   plan_type            4200 non-null   object        
     3   plan_tier            4200 non-null   object        
     4   monthly_price        4200 non-null   float64       
     5   acquisition_channel  4200 non-null   object        
     6   primary_device       4200 non-null   object        
     7   age_group            4200 non-null   object        
     8   churned              4200 non-null   object        
     9   churn_date           1768 non-null   datetime64[ns]
     10  cancel_reason        4200 non-null   object        
    dtypes: datetime64[ns](2), float64(1), int64(1), object(7)
    memory usage: 361.1+ KB
    
    
    <class 'pandas.core.frame.DataFrame'>
    RangeIndex: 30525 entries, 0 to 30524
    Data columns (total 6 columns):
     #   Column              Non-Null Count  Dtype         
    ---  ------              --------------  -----         
     0   customer_id         30525 non-null  int64         
     1   month               30525 non-null  datetime64[ns]
     2   workouts_completed  30525 non-null  int64         
     3   minutes_active      30022 non-null  float64       
     4   classes_booked      30525 non-null  int64         
     5   support_tickets     30525 non-null  int64         
    dtypes: datetime64[ns](1), float64(1), int64(4)
    memory usage: 1.4 MB
    
  8. 2. Overall Customer Churn Analysis

    In this section, we calculate the overall customer churn percentage to understand how many subscribers cancelled their subscriptions by December 31, 2025.

    Business Objective

    Determine the proportion of customers who have cancelled their subscriptions compared with the total customer base.

    Key Metrics

    • Total Customers: Total number of subscribed customers.
    • Churned Customers: Customers who cancelled their subscriptions.
    • Active Customers: Customers whose subscriptions had not been cancelled by December 31, 2025.
    • Observed Cumulative Churn Percentage: Percentage of customers who cancelled during the observation period.

    Business Importance

    Understanding the overall churn percentage provides an initial indication of customer retention.

    This metric will serve as a baseline for further analysis of subscription plans, customer demographics, acquisition channels and engagement patterns.

    Note: This is a cumulative observed churn percentage, not a monthly churn rate. Customers have different subscription tenures, so this metric alone cannot establish which customer groups have higher churn risk.

  9. total_customers = len(subscriptions)
    
    churned_customers = (
        subscriptions["churned"] == "yes"
    ).sum()
    
    active_customers = (
        subscriptions["churned"] == "no"
    ).sum()
    
    churn_percentage = (
        churned_customers / total_customers
    ) * 100
    
    active_percentage = (
        active_customers / total_customers
    ) * 100
    
    print("Total Customers:", total_customers)
    print("Churned Customers:", churned_customers)
    print("Active Customers:", active_customers)
    
    print(f"\nObserved Churn Percentage: {churn_percentage:.2f}%")
    print(f"Active Customer Percentage: {active_percentage:.2f}%")
    Total Customers: 4200
    Churned Customers: 1768
    Active Customers: 2432
    
    Observed Churn Percentage: 42.10%
    Active Customer Percentage: 57.90%
    
  10. #churn distribution
    churn_counts = subscriptions["churned"].value_counts()
    
    plt.figure(figsize=(7, 5))
    
    plt.pie(
        churn_counts,
        labels=churn_counts.index,
        autopct="%1.1f%%",
        startangle=90
    )
    
    plt.title("Customer Churn Distribution")
    plt.show()
    Chart produced by this cell
    <Figure size 700x500 with 1 Axes>
  11. 2.1 Overall Customer Churn – Key Findings

    After analyzing the subscription dataset, we identified the following results:

    • Total customers: 4,200
    • Churned customers: 1,768
    • Active customers: 2,432
    • Observed cumulative churn percentage: 42.10%
    • Active customer percentage: 57.90%

    Key Observation

    Approximately 42.10% of the customers cancelled their subscriptions by December 31, 2025, while 57.90% remained active.

    This provides an initial understanding of customer retention.

    Business Interpretation

    The overall observed churn percentage provides a baseline for understanding customer cancellations.

    However, this metric does not explain which customer groups are more likely to churn or when cancellations occur.

    Further analysis is required to identify the factors associated with customer churn while accounting for differences in subscription tenure.

  12. print(churn_counts)
    
    print(
        (churn_counts / churn_counts.sum() * 100).round(2)
    )
    churned
    no     2432
    yes    1768
    Name: count, dtype: int64
    churned
    no     57.9
    yes    42.1
    Name: count, dtype: float64
    
  13. 3. Customer Churn Analysis by Plan Type

    In this section, we analyze customer churn across different subscription billing periods.

    The dataset contains two subscription types:

    • Monthly
    • Annual

    Business Objectives

    • Calculate the total number of customers under each plan type.
    • Identify the number of churned and active customers.
    • Calculate the observed cumulative churn percentage for each plan type.
    • Compare customer retention between monthly and annual subscribers.

    Business Importance

    Understanding churn across subscription types can help the membership team identify differences in customer retention behaviour.

    The findings may help leadership evaluate subscription pricing, billing preferences and retention strategies.

    Note: These are cumulative observed churn percentages. Monthly and annual subscribers may have different subscription tenures, so we will account for tenure before drawing final conclusions.

  14. plan_churn = (
        subscriptions
        .groupby("plan_type")
        .agg(
            total_customers=("customer_id", "count"),
            churned_customers=(
                "churned",
                lambda x: (x == "yes").sum()
            ),
            active_customers=(
                "churned",
                lambda x: (x == "no").sum()
            )
        )
        .reset_index()
    )
    
    plan_churn["churn_rate_pct"] = (
        plan_churn["churned_customers"]
        / plan_churn["total_customers"]
    ) * 100
    
    plan_churn["churn_rate_pct"] = (
        plan_churn["churn_rate_pct"].round(2)
    )
    
    plan_churn
      plan_type  total_customers  churned_customers  active_customers  \
    0    annual             1539                406              1133   
    1   monthly             2661               1362              1299   
    
       churn_rate_pct  
    0           26.38  
    1           51.18  
  15. plt.figure(figsize=(8, 5))
    
    sns.barplot(
        data=plan_churn,
        x="plan_type",
        y="churn_rate_pct"
    )
    
    plt.title("Observed Cumulative Churn Rate by Plan Type")
    plt.xlabel("Subscription Plan Type")
    plt.ylabel("Churn Rate (%)")
    
    plt.show()
    Chart produced by this cell
    <Figure size 800x500 with 1 Axes>
  16. 3.1 Customer Churn by Plan Type – Key Findings

    The analysis revealed differences in observed cumulative churn across subscription billing periods.

    Annual Plan:

    • Total customers: 1,539
    • Churned customers: 406
    • Active customers: 1,133
    • Observed cumulative churn: 26.38%

    Monthly Plan:

    • Total customers: 2,661
    • Churned customers: 1,362
    • Active customers: 1,299
    • Observed cumulative churn: 51.18%

    Key Observation

    Monthly subscribers have a higher observed cumulative churn percentage than annual subscribers.

    The difference between the two groups is approximately 24.80 percentage points.

    Business Interpretation

    Monthly subscribers may exhibit different retention behaviour compared with annual subscribers.

    This finding suggests that billing period could be an important factor to investigate when understanding customer churn.

    However, subscription tenure must be considered before determining whether this difference remains consistent across customers with similar subscription durations.

    Conclusion

    Monthly subscribers show higher observed cumulative churn in the dataset. Further tenure-adjusted analysis is required before identifying subscription type as a major churn driver.

  17. 4. Customer Churn Analysis by Plan Tier

    In this section, we analyze customer churn across the three subscription tiers offered by the fitness application:

    • Basic
    • Plus
    • Premium

    Business Objectives

    • Calculate the total customers in each subscription tier.
    • Identify churned and active customers in each tier.
    • Calculate the observed cumulative churn percentage.
    • Compare customer retention across subscription tiers.

    Business Importance

    This analysis will help us understand whether customers with different subscription levels demonstrate different retention patterns.

    The findings may help the membership team evaluate subscription features, pricing and customer value.

    Note: These are observed cumulative churn percentages. We will account for subscription tenure before drawing final conclusions.

  18. tier_churn = (
        subscriptions
        .groupby("plan_tier")
        .agg(
            total_customers=("customer_id", "count"),
            churned_customers=(
                "churned",
                lambda x: (x == "yes").sum()
            ),
            active_customers=(
                "churned",
                lambda x: (x == "no").sum()
            )
        )
        .reset_index()
    )
    
    tier_churn["churn_rate_pct"] = (
        tier_churn["churned_customers"]
        / tier_churn["total_customers"]
    ) * 100
    
    tier_churn["churn_rate_pct"] = (
        tier_churn["churn_rate_pct"].round(2)
    )
    
    tier_churn
      plan_tier  total_customers  churned_customers  active_customers  \
    0     basic             1976                831              1145   
    1      plus             1501                623               878   
    2   premium              723                314               409   
    
       churn_rate_pct  
    0           42.05  
    1           41.51  
    2           43.43  
  19. plt.figure(figsize=(8, 5))
    
    sns.barplot(
        data=tier_churn,
        x="plan_tier",
        y="churn_rate_pct"
    )
    
    plt.title("Observed Cumulative Churn Rate by Plan Tier")
    plt.xlabel("Subscription Tier")
    plt.ylabel("Churn Rate (%)")
    
    plt.show()
    Chart produced by this cell
    <Figure size 800x500 with 1 Axes>
  20. 4.1 Customer Churn by Plan Tier – Key Findings

    The analysis revealed the following observed cumulative churn percentages:

    Basic Plan:

    • Total customers: 1,976
    • Churned customers: 831
    • Active customers: 1,145
    • Observed cumulative churn: 42.05%

    Plus Plan:

    • Total customers: 1,501
    • Churned customers: 623
    • Active customers: 878
    • Observed cumulative churn: 41.51%

    Premium Plan:

    • Total customers: 723
    • Churned customers: 314
    • Active customers: 409
    • Observed cumulative churn: 43.43%

    Key Observations

    • Premium subscribers have the highest observed cumulative churn percentage.
    • Plus subscribers have the lowest observed cumulative churn percentage.
    • The difference between the highest and lowest churn percentages is approximately 1.92 percentage points.

    Business Interpretation

    Customer churn percentages are relatively similar across the three subscription tiers.

    This suggests that subscription tier alone may not explain substantial differences in customer cancellations.

    Further investigation is required to determine whether these patterns remain consistent when customer tenure is considered.

    Conclusion

    No major difference in observed cumulative churn was identified across subscription tiers. Additional analysis of customer engagement, acquisition channels and tenure will help identify more meaningful churn patterns.

  21. 5. Customer Churn Analysis by Acquisition Channel

    In this section, we analyze customer churn across different acquisition channels.

    The dataset contains five acquisition channels:

    • Organic
    • Paid Social
    • Promo Offer
    • Referral
    • Partner

    Business Objectives

    • Calculate the total customers acquired through each channel.
    • Identify churned and active customers from each channel.
    • Calculate the observed cumulative churn percentage for each channel.
    • Compare customer retention across acquisition sources.

    Business Importance

    Understanding churn across acquisition channels can help the membership team evaluate the quality and retention behaviour of customers acquired through different marketing sources.

    The findings may help leadership assess marketing effectiveness and optimize customer acquisition strategies.

    Note: These are observed cumulative churn percentages. Differences in customer tenure must be considered before drawing final conclusions about acquisition channel performance.

  22. channel_churn = (
        subscriptions
        .groupby("acquisition_channel")
        .agg(
            total_customers=("customer_id", "count"),
            churned_customers=(
                "churned",
                lambda x: (x == "yes").sum()
            ),
            active_customers=(
                "churned",
                lambda x: (x == "no").sum()
            )
        )
        .reset_index()
    )
    
    channel_churn["churn_rate_pct"] = (
        channel_churn["churned_customers"]
        / channel_churn["total_customers"]
    ) * 100
    
    channel_churn["churn_rate_pct"] = (
        channel_churn["churn_rate_pct"].round(2)
    )
    
    channel_churn
      acquisition_channel  total_customers  churned_customers  active_customers  \
    0             organic             1298                532               766   
    1         paid_social              989                385               604   
    2             partner              476                204               272   
    3         promo_offer              949                482               467   
    4            referral              488                165               323   
    
       churn_rate_pct  
    0           40.99  
    1           38.93  
    2           42.86  
    3           50.79  
    4           33.81  
  23. plt.figure(figsize=(9, 5))
    
    sns.barplot(
        data=channel_churn,
        x="acquisition_channel",
        y="churn_rate_pct"
    )
    
    plt.title("Observed Cumulative Churn Rate by Acquisition Channel")
    plt.xlabel("Acquisition Channel")
    plt.ylabel("Churn Rate (%)")
    plt.xticks(rotation=20)
    
    plt.show()
    Chart produced by this cell
    <Figure size 900x500 with 1 Axes>
  24. 5.1 Customer Churn by Acquisition Channel – Key Findings

    The analysis revealed differences in observed cumulative churn across acquisition channels.

    Organic:

    • Total customers: 1,298
    • Churned customers: 532
    • Observed cumulative churn: 40.99%

    Paid Social:

    • Total customers: 989
    • Churned customers: 385
    • Observed cumulative churn: 38.93%

    Partner:

    • Total customers: 476
    • Churned customers: 204
    • Observed cumulative churn: 42.86%

    Promo Offer:

    • Total customers: 949
    • Churned customers: 482
    • Observed cumulative churn: 50.79%

    Referral:

    • Total customers: 488
    • Churned customers: 165
    • Observed cumulative churn: 33.81%

    Key Observations

    • Promo Offer has the highest observed cumulative churn percentage at 50.79%.
    • Referral has the lowest observed cumulative churn percentage at 33.81%.
    • The difference between these two channels is approximately 16.98 percentage points.

    Business Interpretation

    Customers acquired through promotional offers appear to have weaker observed retention compared with customers acquired through referrals.

    This may indicate that some promotional campaigns attract customers who are more price-sensitive or less committed to long-term subscriptions.

    Referral customers demonstrate comparatively stronger observed retention.

    Conclusion

    Acquisition channel may be an important factor associated with customer churn.

    Further investigation is required to determine whether these differences remain when customer tenure is taken into account.

  25. # Group customers based on their acquisition channel
    # Calculate the total, churned and active customers for each channel
    
    channel_churn = (
        subscriptions
        .groupby("acquisition_channel")
        .agg(
            # Count the total number of customers in each channel
            total_customers=("customer_id", "count"),
    
            # Count customers whose churn status is "yes"
            churned_customers=(
                "churned",
                lambda x: (x == "yes").sum()
            ),
    
            # Count customers whose churn status is "no"
            active_customers=(
                "churned",
                lambda x: (x == "no").sum()
            )
        )
        .reset_index()  # Convert acquisition_channel back into a regular column
    )
    
    # Calculate the observed cumulative churn percentage for each channel
    channel_churn["churn_rate_pct"] = (
        channel_churn["churned_customers"]
        / channel_churn["total_customers"]
    ) * 100
    
    # Round the percentages to two decimal places
    channel_churn["churn_rate_pct"] = (
        channel_churn["churn_rate_pct"].round(2)
    )
    
    # Display the final summary table
    channel_churn
      acquisition_channel  total_customers  churned_customers  active_customers  \
    0             organic             1298                532               766   
    1         paid_social              989                385               604   
    2             partner              476                204               272   
    3         promo_offer              949                482               467   
    4            referral              488                165               323   
    
       churn_rate_pct  
    0           40.99  
    1           38.93  
    2           42.86  
    3           50.79  
    4           33.81  
  26. 6. Customer Churn Analysis by Primary Device

    In this section, we analyze customer churn across different primary devices.

    The dataset contains three device categories:

    • iOS
    • Android
    • Web

    Business Objectives

    • Calculate the total number of customers using each device.
    • Identify churned and active customers for each device.
    • Calculate the observed cumulative churn percentage.
    • Compare retention patterns across devices.

    Business Importance

    Understanding device-level customer behaviour may help identify differences in user experience and engagement.

    The findings may help the product team investigate whether particular platforms have customer experience or usability issues.

    Note: These are observed cumulative churn percentages. We will account for customer tenure before drawing final conclusions.

  27. # Group customers according to their primary device
    device_churn = (
        subscriptions
        .groupby("primary_device")
        .agg(
            # Count total customers using each device
            total_customers=("customer_id", "count"),
    
            # Count customers who cancelled their subscriptions
            churned_customers=(
                "churned",
                lambda x: (x == "yes").sum()
            ),
    
            # Count customers who are still active
            active_customers=(
                "churned",
                lambda x: (x == "no").sum()
            )
        )
        .reset_index()
    )
    
    # Calculate the observed cumulative churn percentage
    device_churn["churn_rate_pct"] = (
        device_churn["churned_customers"]
        / device_churn["total_customers"]
    ) * 100
    
    # Round the churn percentages to two decimal places
    device_churn["churn_rate_pct"] = (
        device_churn["churn_rate_pct"].round(2)
    )
    
    # Display the device-wise churn summary
    device_churn
      primary_device  total_customers  churned_customers  active_customers  \
    0        android             1550                697               853   
    1            ios             1976                799              1177   
    2            web              674                272               402   
    
       churn_rate_pct  
    0           44.97  
    1           40.44  
    2           40.36  
  28. # Set the chart dimensions
    plt.figure(figsize=(8, 5))
    
    # Create a bar chart comparing churn percentages by device
    sns.barplot(
        data=device_churn,
        x="primary_device",
        y="churn_rate_pct"
    )
    
    # Add chart title and axis labels
    plt.title("Observed Cumulative Churn Rate by Primary Device")
    plt.xlabel("Primary Device")
    plt.ylabel("Churn Rate (%)")
    
    # Display the chart
    plt.show()
    Chart produced by this cell
    <Figure size 800x500 with 1 Axes>
  29. 6.1 Customer Churn by Primary Device – Key Findings

    The analysis revealed differences in observed cumulative churn across primary devices.

    Android:

    • Total customers: 1,550
    • Churned customers: 697
    • Active customers: 853
    • Observed cumulative churn: 44.97%

    iOS:

    • Total customers: 1,976
    • Churned customers: 799
    • Active customers: 1,177
    • Observed cumulative churn: 40.44%

    Web:

    • Total customers: 674
    • Churned customers: 272
    • Active customers: 402
    • Observed cumulative churn: 40.36%

    Key Observations

    • Android has the highest observed cumulative churn percentage at 44.97%.
    • Web has the lowest observed cumulative churn percentage at 40.36%.
    • The difference between Android and Web is approximately 4.61 percentage points.

    Business Interpretation

    Android users demonstrate comparatively higher observed cumulative churn.

    This may indicate differences in user experience, platform performance or engagement behaviour.

    The product team could investigate Android application usability, technical issues and customer feedback.

    Conclusion

    Primary device may be associated with differences in customer retention. However, further analysis is required to determine whether these differences remain when customer tenure is considered.

  30. 7. Customer Churn Analysis by Age Group

    In this section, we analyze customer churn across different age groups.

    The dataset contains five age categories:

    • 18-24
    • 25-34
    • 35-44
    • 45-54
    • 55+

    Business Objectives

    • Calculate the total number of customers in each age group.
    • Identify churned and active customers across age groups.
    • Calculate the observed cumulative churn percentage.
    • Compare customer retention patterns across different age categories.

    Business Importance

    Understanding churn across age groups may help the membership team identify differences in customer preferences, engagement and subscription behaviour.

    These findings could help the company develop more relevant customer experiences and retention strategies for different age groups.

    Note: These are observed cumulative churn percentages. We will account for customer tenure before drawing final conclusions.

  31. # Group customers according to their age group
    age_churn = (
        subscriptions
        .groupby("age_group")
        .agg(
            # Count the total customers in each age group
            total_customers=("customer_id", "count"),
    
            # Count customers who cancelled their subscriptions
            churned_customers=(
                "churned",
                lambda x: (x == "yes").sum()
            ),
    
            # Count customers who are still active
            active_customers=(
                "churned",
                lambda x: (x == "no").sum()
            )
        )
        .reset_index()  # Convert age_group back into a regular column
    )
    
    # Calculate the observed cumulative churn percentage
    age_churn["churn_rate_pct"] = (
        age_churn["churned_customers"]
        / age_churn["total_customers"]
    ) * 100
    
    # Round percentages to two decimal places
    age_churn["churn_rate_pct"] = (
        age_churn["churn_rate_pct"].round(2)
    )
    
    # Display the age-group churn summary
    age_churn
      age_group  total_customers  churned_customers  active_customers  \
    0     18-24              717                307               410   
    1     25-34             1400                594               806   
    2     35-44             1073                451               622   
    3     45-54              619                264               355   
    4       55+              391                152               239   
    
       churn_rate_pct  
    0           42.82  
    1           42.43  
    2           42.03  
    3           42.65  
    4           38.87  
  32. # Define the age-group order for the chart
    age_order = ["18-24", "25-34", "35-44", "45-54", "55+"]
    
    # Set the chart dimensions
    plt.figure(figsize=(9, 5))
    
    # Create a bar chart comparing churn percentages across age groups
    sns.barplot(
        data=age_churn,
        x="age_group",
        y="churn_rate_pct",
        order=age_order
    )
    
    # Add chart title and axis labels
    plt.title("Observed Cumulative Churn Rate by Age Group")
    plt.xlabel("Age Group")
    plt.ylabel("Churn Rate (%)")
    
    # Display the chart
    plt.show()
    Chart produced by this cell
    <Figure size 900x500 with 1 Axes>
  33. 7.1 Customer Churn by Age Group – Key Findings

    The analysis revealed the following observed cumulative churn percentages across different age groups.

    18-24:

    • Total customers: 717
    • Churned customers: 307
    • Observed cumulative churn: 42.82%

    25-34:

    • Total customers: 1,400
    • Churned customers: 594
    • Observed cumulative churn: 42.43%

    35-44:

    • Total customers: 1,073
    • Churned customers: 451
    • Observed cumulative churn: 42.03%

    45-54:

    • Total customers: 619
    • Churned customers: 264
    • Observed cumulative churn: 42.65%

    55+:

    • Total customers: 391
    • Churned customers: 152
    • Observed cumulative churn: 38.87%

    Key Observations

    • The 18-24 age group has the highest observed cumulative churn percentage at 42.82%.
    • The 55+ age group has the lowest observed cumulative churn percentage at 38.87%.
    • The remaining age groups have relatively similar churn percentages.
    • The difference between the highest and lowest percentages is approximately 3.95 percentage points.

    Business Interpretation

    Customer churn percentages are relatively similar across most age groups.

    This suggests that age group alone may not be a strong differentiator of customer churn.

    Further analysis of customer engagement, subscription behaviour and tenure is required to identify more meaningful patterns.

    Conclusion

    No substantial difference in observed cumulative churn was identified across age groups. Tenure-adjusted analysis will help determine whether these differences remain after accounting for subscription duration.

  34. 8. Customer Tenure and Monthly Churn Analysis

    In this section, we investigate customer subscription tenure and monthly churn behaviour.

    Business Objective

    Recently acquired customers have had less time to cancel their subscriptions compared with customers who joined earlier.

    Comparing cumulative churn percentages without considering subscription duration can therefore produce misleading results.

    Our objective is to account for customer tenure and understand when cancellations occur.

    Definitions

    Customer Churn:

    A customer is considered churned if they cancelled their subscription by December 31, 2025.

    Customer Tenure:

    The duration for which a customer has been subscribed.

    For monthly analysis, the first calendar month of the subscription is considered tenure month 1.

    Monthly Churn Rate:

    Monthly cancellations divided by the number of customers who were active during that calendar month, multiplied by 100.

    Analysis Objectives

    • Calculate customer tenure by subscription month.
    • Identify cancellations across different calendar months.
    • Calculate monthly churn rates.
    • Analyze churn patterns across tenure periods.
    • Identify when customers are most likely to cancel.

    Business Importance

    This analysis will help the membership team understand customer retention more fairly by accounting for differences in subscription duration.

    It will also help identify critical periods when customers may require additional engagement or retention support.

  35. # Define the final date of our dataset observation period
    observation_end = pd.Timestamp("2025-12-31")
    
    # Find the first signup month in the subscriptions dataset
    start_month = subscriptions["signup_date"].min().to_period("M")
    
    # Convert the observation end date into a monthly period
    end_month = observation_end.to_period("M")
    
    # Generate all calendar months in the observation period
    calendar_months = pd.DataFrame({
        "month": pd.period_range(
            start=start_month,
            end=end_month,
            freq="M"
        )
    })
    
    # Create every possible customer-month combination
    customer_months = subscriptions.merge(
        calendar_months,
        how="cross"
    )
    
    # Find the beginning of each calendar month
    customer_months["month_start"] = (
        customer_months["month"].dt.to_timestamp()
    )
    
    # Find the end of each calendar month
    customer_months["month_end"] = (
        customer_months["month"].dt.to_timestamp(how="end")
    )
    
    # Identify months during which each customer was subscribed
    # A customer must have signed up by the end of the month
    # and must not have cancelled before the month started
    active_mask = (
        (customer_months["signup_date"] <= customer_months["month_end"])
        &
        (
            customer_months["churn_date"].isna()
            |
            (customer_months["churn_date"] >= customer_months["month_start"])
        )
    )
    
    # Keep only customer-months during which the customer was subscribed
    customer_months = customer_months.loc[active_mask].copy()
    
    # Create a month number representing the customer's subscription tenure
    # Signup calendar month = tenure month 1
    customer_months["signup_month"] = (
        customer_months["signup_date"].dt.to_period("M")
    )
    
    customer_months["tenure_month"] = (
        customer_months["month"].astype("int64")
        - customer_months["signup_month"].astype("int64")
        + 1
    )
    
    # Identify whether the customer cancelled during that calendar month
    customer_months["churned_this_month"] = (
        customer_months["churn_date"].notna()
        &
        (
            customer_months["churn_date"].dt.to_period("M")
            == customer_months["month"]
        )
    )
    
    # Check the resulting customer-month dataset
    print("Customer-month records:", customer_months.shape)
    
    customer_months[
        [
            "customer_id",
            "month",
            "tenure_month",
            "churned_this_month"
        ]
    ].head(10)
    Customer-month records: (31789, 17)
    
        customer_id    month  tenure_month  churned_this_month
    2             1  2024-09             1               False
    3             1  2024-10             2               False
    4             1  2024-11             3               False
    5             1  2024-12             4               False
    6             1  2025-01             5               False
    7             1  2025-02             6               False
    8             1  2025-03             7               False
    9             1  2025-04             8               False
    10            1  2025-05             9               False
    11            1  2025-06            10                True
  36. # Extract customer ID and month from our generated dataset
    expected_keys = customer_months[
        ["customer_id", "month"]
    ].copy()
    
    # Extract customer ID and month from the usage dataset
    actual_keys = usage[
        ["customer_id", "month"]
    ].copy()
    
    # Convert usage dates into monthly periods for comparison
    actual_keys["month"] = actual_keys["month"].dt.to_period("M")
    
    # Check whether the generated dataset contains duplicate customer-month pairs
    print(
        "Generated duplicate combinations:",
        expected_keys.duplicated().sum()
    )
    
    # Compare the expected and actual customer-month combinations
    comparison = expected_keys.merge(
        actual_keys,
        on=["customer_id", "month"],
        how="outer",
        indicator=True
    )
    
    # Count matching and non-matching customer-month combinations
    print("\nCustomer-month comparison:")
    print(comparison["_merge"].value_counts())
    Generated duplicate combinations: 0
    
    Customer-month comparison:
    _merge
    both          30525
    left_only      1264
    right_only        0
    Name: count, dtype: int64
    
  37. 8.1 Customer-Month Data Completeness Check

    After generating the expected customer-month records using subscription signup and cancellation dates, we compared them with the actual usage dataset.

    The comparison produced the following results:

    ComparisonRecords
    Records present in both datasets30,525
    Expected records missing from usage1,264
    Unexpected records in usage0
    Total expected customer-month records31,789

    Key Observation

    The generated customer-month dataset contains 31,789 unique customer-month combinations, while the cleaned usage dataset contains 30,525 unique combinations.

    We identified 1,264 expected customer-month combinations without corresponding usage records.

    All existing usage records were successfully matched with the generated customer-month dataset.

    Business Implication

    The usage dataset appears to have incomplete customer-month coverage compared with the subscription records.

    Missing usage records should not automatically be interpreted as zero customer engagement.

    Further investigation is required to understand how these missing records are distributed across customers and calendar months.

    Conclusion

    We identified a difference between expected subscription coverage and recorded usage data.

    We will investigate this discrepancy before calculating monthly churn rates or performing engagement analysis.

  38. # Extract customer-month combinations that exist in the
    # generated dataset but are missing from the usage dataset
    
    missing_usage_months = comparison.loc[
        comparison["_merge"] == "left_only",
        ["customer_id", "month"]
    ].copy()
    
    # Count the missing customer-month combinations
    print("Missing customer-month records:",
          len(missing_usage_months))
    
    # Count how many unique customers are affected
    print("Customers affected:",
          missing_usage_months["customer_id"].nunique())
    Missing customer-month records: 1264
    Customers affected: 139
    
  39. # Count missing usage records for each calendar month
    
    missing_by_month = (
        missing_usage_months
        .groupby("month")
        .size()
        .reset_index(name="missing_records")
    )
    
    # Display months with the most missing records first
    missing_by_month = missing_by_month.sort_values(
        "missing_records",
        ascending=False
    )
    
    missing_by_month
          month  missing_records
    16  2025-12              139
    15  2025-11              139
    14  2025-10              134
    13  2025-09              122
    12  2025-08              112
    11  2025-07              105
    10  2025-06               93
    9   2025-05               85
    8   2025-04               73
    7   2025-03               62
    6   2025-02               55
    5   2025-01               48
    4   2024-12               40
    3   2024-11               28
    2   2024-10               16
    1   2024-09                9
    0   2024-08                4
  40. # Attach customer subscription information to missing records
    
    missing_usage_detail = missing_usage_months.merge(
        subscriptions[
            [
                "customer_id",
                "churned",
                "plan_type",
                "plan_tier",
                "signup_date",
                "churn_date"
            ]
        ],
        on="customer_id",
        how="left"
    )
    
    # Count missing customer-month records by churn status
    print("Missing records by customer status:")
    
    print(
        missing_usage_detail["churned"].value_counts()
    )
    Missing records by customer status:
    churned
    no    1264
    Name: count, dtype: int64
    
  41. # Count how many usage months are missing for each customer
    
    missing_by_customer = (
        missing_usage_detail
        .groupby("customer_id")
        .size()
        .sort_values(ascending=False)
    )
    
    # Display a statistical summary
    print(missing_by_customer.describe())
    
    # Show the 10 customers with the most missing usage months
    print("\nTop 10 affected customers:")
    
    print(missing_by_customer.head(10))
    count    139.000000
    mean       9.093525
    std        4.291704
    min        2.000000
    25%        6.000000
    50%        9.000000
    75%       13.000000
    max       17.000000
    dtype: float64
    
    Top 10 affected customers:
    customer_id
    2613    17
    1519    17
    2079    17
    2373    17
    1956    16
    2670    16
    3277    16
    181     16
    144     16
    614     15
    dtype: int64
    
  42. 8.2 Investigation of Missing Customer-Month Records

    Further investigation was performed to understand the distribution of the 1,264 missing customer-month records.

    1. Customers Affected

    • Total missing customer-month records: 1,264.
    • Unique customers affected: 139.
    • Average missing months per affected customer: approximately 9.09.
    • Maximum missing months for one customer: 17.

    2. Customer Subscription Status

    All 1,264 missing customer-month records belong to customers whose subscription status is no (not churned).

    This means all 139 affected customers were still active as of December 31, 2025.

    3. Monthly Distribution

    The missing records were identified across calendar months from August 2024 through December 2025.

    The number of missing records was highest in November and December 2025, with 139 missing records in each month.

    The increasing number of missing records across later months suggests that usage data completeness may vary over time.

    4. Key Observation

    The missing customer-month combinations are concentrated among active subscribers.

    Some customers have multiple months without corresponding usage records, with an average of approximately nine missing months per affected customer.

    5. Business Implication

    Incomplete usage records may affect engagement analysis, including workouts completed, active minutes and classes booked.

    Missing records cannot automatically be interpreted as zero customer engagement.

    Conclusion

    We identified incomplete usage coverage affecting 139 active customers.

    Further investigation is required to determine whether the missing records represent gaps in usage tracking or another data collection issue.

    These records will be treated as missing information rather than assumed zero activity.

  43. # Convert the usage date into a monthly period
    # without modifying the original usage dataset
    
    usage_monthly = usage.assign(
        usage_month=usage["month"].dt.to_period("M")
    )
    
    # Find the first and last recorded usage month for every customer
    actual_usage_summary = (
        usage_monthly
        .groupby("customer_id")
        .agg(
            first_recorded_month=("usage_month", "min"),
            last_recorded_month=("usage_month", "max"),
            recorded_months=("usage_month", "nunique")
        )
        .reset_index()
    )
    
    # Display the first 10 customers
    actual_usage_summary.head(10)
       customer_id first_recorded_month last_recorded_month  recorded_months
    0            1              2024-09             2025-06               10
    1            2              2025-08             2025-12                5
    2            3              2025-01             2025-01                1
    3            4              2024-08             2024-08                1
    4            5              2025-06             2025-12                7
    5            6              2024-08             2025-03                8
    6            7              2024-11             2024-12                2
    7            8              2025-10             2025-12                3
    8            9              2024-08             2025-07               12
    9           10              2025-01             2025-12               12
  44. # Group missing customer-month records by customer ID
    # and identify each customer's missing-month range
    
    missing_customer_summary = (
        missing_usage_months
        .groupby("customer_id")
        .agg(
            missing_months=("month", "size"),
            first_missing_month=("month", "min"),
            last_missing_month=("month", "max")
        )
        .reset_index()
    )
    
    # Combine missing-month information with actual usage history
    missing_customer_summary = missing_customer_summary.merge(
        actual_usage_summary,
        on="customer_id",
        how="left"
    )
    
    # Display the customers with the most missing records
    missing_customer_summary.sort_values(
        "missing_months",
        ascending=False
    ).head(10)
         customer_id  missing_months first_missing_month last_missing_month  \
    82          2613              17             2024-08            2025-12   
    55          1519              17             2024-08            2025-12   
    70          2079              17             2024-08            2025-12   
    77          2373              17             2024-08            2025-12   
    68          1956              16             2024-09            2025-12   
    83          2670              16             2024-09            2025-12   
    102         3277              16             2024-09            2025-12   
    8            181              16             2024-09            2025-12   
    4            144              16             2024-09            2025-12   
    24           614              15             2024-10            2025-12   
    
        first_recorded_month last_recorded_month  recorded_months  
    82               2024-07             2024-07                1  
    55               2024-07             2024-07                1  
    70               2024-07             2024-07                1  
    77               2024-07             2024-07                1  
    68               2024-08             2024-08                1  
    83               2024-08             2024-08                1  
    102              2024-08             2024-08                1  
    8                2024-08             2024-08                1  
    4                2024-08             2024-08                1  
    24               2024-09             2024-09                1  
  45. # Attach each customer's last recorded usage month
    # to their missing customer-month records
    
    missing_month_check = missing_usage_months.merge(
        actual_usage_summary[
            ["customer_id", "last_recorded_month"]
        ],
        on="customer_id",
        how="left"
    )
    
    # Identify missing months that occur after the last recorded month
    missing_month_check["missing_after_last_usage"] = (
        missing_month_check["month"]
        > missing_month_check["last_recorded_month"]
    )
    
    # Count missing records after versus before/interspersed with
    # the customer's last recorded usage month
    print(
        missing_month_check[
            "missing_after_last_usage"
        ].value_counts()
    )
    missing_after_last_usage
    True    1264
    Name: count, dtype: int64
    
  46. # Combine customer subscription information
    # with their usage coverage summary
    
    coverage_details = missing_customer_summary.merge(
        subscriptions[
            [
                "customer_id",
                "churned",
                "plan_type",
                "plan_tier",
                "signup_date"
            ]
        ],
        on="customer_id",
        how="left"
    )
    
    # Display the most affected customers with their subscription details
    coverage_details.sort_values(
        "missing_months",
        ascending=False
    ).head(10)
         customer_id  missing_months first_missing_month last_missing_month  \
    82          2613              17             2024-08            2025-12   
    55          1519              17             2024-08            2025-12   
    70          2079              17             2024-08            2025-12   
    77          2373              17             2024-08            2025-12   
    68          1956              16             2024-09            2025-12   
    83          2670              16             2024-09            2025-12   
    102         3277              16             2024-09            2025-12   
    8            181              16             2024-09            2025-12   
    4            144              16             2024-09            2025-12   
    24           614              15             2024-10            2025-12   
    
        first_recorded_month last_recorded_month  recorded_months churned  \
    82               2024-07             2024-07                1      no   
    55               2024-07             2024-07                1      no   
    70               2024-07             2024-07                1      no   
    77               2024-07             2024-07                1      no   
    68               2024-08             2024-08                1      no   
    83               2024-08             2024-08                1      no   
    102              2024-08             2024-08                1      no   
    8                2024-08             2024-08                1      no   
    4                2024-08             2024-08                1      no   
    24               2024-09             2024-09                1      no   
    
        plan_type plan_tier signup_date  
    82    monthly     basic  2024-07-27  
    55    monthly     basic  2024-07-21  
    70    monthly      plus  2024-07-28  
    77     annual     basic  2024-07-07  
    68    monthly   premium  2024-08-20  
    83    monthly      plus  2024-08-26  
    102   monthly      plus  2024-08-26  
    8     monthly   premium  2024-08-15  
    4     monthly      plus  202
  47. 8.3 Pattern Analysis of Missing Usage Records

    Further investigation was performed to understand when usage records were missing for the 139 affected customers.

    1. First and Last Recorded Usage

    We identified the first and last recorded usage months for each customer.

    This helped us understand how much usage history was available for individual subscribers.

    Some customers had multiple months of recorded activity, while others had only one recorded month.

    2. Missing Usage Pattern

    The investigation confirmed that all 1,264 missing customer-month records occurred after the respective customers' last recorded usage month.

    No missing customer-month combination occurred before a later recorded usage month.

    This indicates that the missing records appear as trailing gaps rather than randomly scattered gaps.

    3. Customer Subscription Status

    All affected customers were classified as active (churned = no).

    This means that their subscription status does not explain why subsequent usage records are absent.

    4. Key Business Observation

    Some active subscribers have very limited recorded usage history despite remaining subscribed during the observation period.

    This may indicate incomplete usage tracking or reporting coverage.

    However, the available data does not establish the actual reason for the missing records.

    5. Business Implications

    Incomplete usage records may affect engagement metrics and customer behaviour analysis.

    Missing usage records should not automatically be interpreted as zero workouts, zero active minutes or a lack of customer engagement.

    Conclusion

    We identified a systematic pattern of trailing missing usage records affecting 139 active customers.

    These records will be treated as missing information rather than assumed zero activity.

    The limitation will be considered when performing engagement and retention analysis.

  48. # Count how many affected customers have each number of recorded usage months
    
    recorded_month_distribution = (
        missing_customer_summary["recorded_months"]
        .value_counts()
        .sort_index()
    )
    
    # Display the distribution
    print(recorded_month_distribution)
    recorded_months
    1    139
    Name: count, dtype: int64
    
  49. # Count customers who have only one recorded usage month
    
    one_month_customers = (
        missing_customer_summary["recorded_months"] == 1
    ).sum()
    
    # Calculate the remaining affected customers
    multiple_month_customers = (
        missing_customer_summary["recorded_months"] > 1
    ).sum()
    
    print("Customers with one recorded month:", one_month_customers)
    
    print("Customers with multiple recorded months:", multiple_month_customers)
    Customers with one recorded month: 139
    Customers with multiple recorded months: 0
    
  50. # Attach the customer's signup date to the usage coverage summary
    
    signup_check = missing_customer_summary.merge(
        subscriptions[["customer_id", "signup_date"]],
        on="customer_id",
        how="left"
    )
    
    # Convert signup date into a monthly period
    signup_check["signup_month"] = (
        signup_check["signup_date"].dt.to_period("M")
    )
    
    # Check whether the last recorded usage month equals the signup month
    signup_check["last_usage_is_signup_month"] = (
        signup_check["last_recorded_month"]
        == signup_check["signup_month"]
    )
    
    # Count customers in each category
    print(
        signup_check["last_usage_is_signup_month"].value_counts()
    )
    last_usage_is_signup_month
    True    139
    Name: count, dtype: int64
    
  51. 8.4 Final Findings – Usage Data Coverage

    The final investigation examined how many usage months were recorded for the 139 affected customers.

    1. Recorded Usage Months

    The investigation revealed:

    • 139 customers had exactly one recorded usage month.
    • 0 customers had multiple recorded usage months.
    • All 139 customers had their last recorded usage month equal to their signup month.

    2. Key Observation

    All affected customers had usage information recorded only during their subscription signup month.

    No subsequent usage records were available for these customers through December 2025, despite their subscriptions remaining active.

    3. Business Implication

    This represents an important limitation in the usage dataset.

    The absence of subsequent usage records does not establish that customers stopped using the application.

    Treating these missing records as zero activity could lead to misleading conclusions about customer engagement and retention.

    4. Final Conclusion

    The usage dataset has incomplete monthly coverage for 139 active customers, representing 1,264 missing customer-month records.

    These customers will require special consideration during engagement analysis.

    We will preserve the distinction between missing usage records and recorded zero activity.


  52. 9. Monthly Customer Churn Analysis

    In this section, we calculate and analyze monthly customer churn rates using the customer-month dataset.

    Business Objective

    Understand how customer cancellations change over time and identify months with higher or lower churn rates.

    Key Metrics

    • Active Customers: Customers who were subscribed during a calendar month.
    • Monthly Cancellations: Customers who cancelled their subscriptions during that month.
    • Monthly Churn Rate: Monthly cancellations divided by active customers, multiplied by 100.

    Calculation Approach

    The customer-month dataset generated from subscription records will be used to calculate monthly active customers and cancellations.

    This approach ensures that the churn calculation is not affected by missing usage records.

    Business Importance

    Monthly churn analysis provides a more comparable view of customer cancellations over time than cumulative churn percentages.

    It can help the membership team identify periods with higher cancellation activity and investigate possible retention issues.

  53. # Group customers by calendar month
    monthly_churn = (
        customer_months
        .groupby("month")
        .agg(
            # Count unique customers subscribed during each month
            active_customers=("customer_id", "nunique"),
    
            # Count customers who cancelled during each month
            monthly_cancellations=("churned_this_month", "sum")
        )
        .reset_index()
    )
    
    # Calculate the monthly churn percentage
    monthly_churn["monthly_churn_rate"] = (
        monthly_churn["monthly_cancellations"]
        / monthly_churn["active_customers"]
    ) * 100
    
    # Round the churn rate to two decimal places
    monthly_churn["monthly_churn_rate"] = (
        monthly_churn["monthly_churn_rate"].round(2)
    )
    
    # Display the monthly churn summary
    monthly_churn
          month  active_customers  monthly_cancellations  monthly_churn_rate
    0   2024-07               172                      8                4.65
    1   2024-08               359                     14                3.90
    2   2024-09               572                     38                6.64
    3   2024-10               785                     36                4.59
    4   2024-11               999                     52                5.21
    5   2024-12              1232                     54                4.38
    6   2025-01              1427                     77                5.40
    7   2025-02              1601                     81                5.06
    8   2025-03              1804                    103                5.71
    9   2025-04              1965                     98                4.99
    10  2025-05              2163                     99                4.58
    11  2025-06              2361                    133                5.63
    12  2025-07              2513                    129                5.13
    13  2025-08              2683                    161                6.00
    14  2025-09              2814                    156                5.54
    15  2025-10              2961                    174                5.88
    16  2025-11              2787                    196                7.03
    17  2025-12              2591                    159                6.14
  54. # Convert monthly periods into timestamps for plotting
    monthly_churn["month_date"] = (
        monthly_churn["month"].dt.to_timestamp()
    )
    
    # Set the chart dimensions
    plt.figure(figsize=(12, 5))
    
    # Create a line chart showing monthly churn trends
    sns.lineplot(
        data=monthly_churn,
        x="month_date",
        y="monthly_churn_rate",
        marker="o"
    )
    
    # Add chart title and axis labels
    plt.title("Monthly Customer Churn Rate")
    plt.xlabel("Month")
    plt.ylabel("Monthly Churn Rate (%)")
    
    # Rotate month labels for better readability
    plt.xticks(rotation=45)
    
    # Adjust chart spacing
    plt.tight_layout()
    
    # Display the chart
    plt.show()
    Chart produced by this cell
    <Figure size 1200x500 with 1 Axes>
  55. 9.1 Monthly Customer Churn – Key Findings

    The monthly churn analysis revealed fluctuations in customer cancellation rates between July 2024 and December 2025.

    Key Observations

    • The highest monthly churn rate was 7.03% in November 2025.
    • The lowest monthly churn rate was 3.90% in August 2024.
    • Monthly churn rates generally show higher values toward the later part of the observation period.
    • Monthly cancellations increased from 8 in July 2024 to 196 in November 2025.

    Business Interpretation

    The results suggest that customer cancellations became more frequent in absolute numbers as the subscriber base expanded.

    Monthly churn percentages also show relatively higher values during several later months.

    However, calendar-month fluctuations alone do not identify the underlying reasons for customer cancellations.

    Further analysis of customer tenure is required to determine when subscribers are most likely to leave after joining the platform.

    Conclusion

    Monthly churn analysis provides an overview of cancellation patterns over time.

    The results highlight November 2025 as the month with the highest observed monthly churn rate.

    Further tenure-based analysis will help identify critical stages in the customer subscription lifecycle.


  56. 10. Customer Churn Analysis by Tenure

    In this section, we analyze customer churn based on the number of months customers have remained subscribed.

    Business Objective

    Identify the stages of the subscription lifecycle when customers are more likely to cancel.

    Tenure Definition

    Customer tenure is measured in calendar subscription months.

    • Signup calendar month = Tenure Month 1.
    • Following calendar month = Tenure Month 2.
    • Third calendar month = Tenure Month 3.

    Analysis Objectives

    • Calculate the number of customers reaching each tenure month.
    • Identify cancellations during each tenure month.
    • Calculate the churn percentage for each tenure month.
    • Identify subscription stages with higher cancellation rates.

    Business Importance

    Understanding tenure-based churn can help the membership team identify critical periods when customers may require additional engagement.

    For example, if cancellations are concentrated during the first three subscription months, the company could introduce onboarding improvements and early engagement programs.

    This analysis will help distinguish customer retention patterns from differences in subscription age.

  57. # Group customers according to their subscription tenure month
    tenure_churn = (
        customer_months
        .groupby("tenure_month")
        .agg(
            # Count customers who reached each tenure month
            customers_active=("customer_id", "nunique"),
    
            # Count customers who cancelled during that tenure month
            cancellations=("churned_this_month", "sum")
        )
        .reset_index()
    )
    
    # Calculate the churn percentage for each tenure month
    tenure_churn["tenure_churn_rate_pct"] = (
        tenure_churn["cancellations"]
        / tenure_churn["customers_active"]
    ) * 100
    
    # Round the churn percentages to two decimal places
    tenure_churn["tenure_churn_rate_pct"] = (
        tenure_churn["tenure_churn_rate_pct"].round(2)
    )
    
    # Display the tenure-based churn summary
    tenure_churn
        tenure_month  customers_active  cancellations  tenure_churn_rate_pct
    0              1              4200            151                   3.60
    1              2              4049            219                   5.41
    2              3              3830            284                   7.42
    3              4              3290            203                   6.17
    4              5              2849            131                   4.60
    5              6              2489             94                   3.78
    6              7              2193             83                   3.78
    7              8              1916             71                   3.71
    8              9              1653             59                   3.57
    9             10              1414             51                   3.61
    10            11              1186             41                   3.46
    11            12               987            323                  32.73
    12            13               554             18                   3.25
    13            14               428             16                   3.74
    14            15               320              9                   2.81
    15            16               227              7                   3.08
    16            17               137              4                   2.92
    17            18                67              4                   5.97
  58. # Set the chart dimensions
    plt.figure(figsize=(12, 5))
    
    # Create a line chart showing churn across subscription tenure
    sns.lineplot(
        data=tenure_churn,
        x="tenure_month",
        y="tenure_churn_rate_pct",
        marker="o"
    )
    
    # Add chart title and labels
    plt.title("Customer Churn Rate by Subscription Tenure")
    plt.xlabel("Subscription Tenure (Months)")
    plt.ylabel("Churn Rate (%)")
    
    # Display the chart
    plt.show()
    Chart produced by this cell
    <Figure size 1200x500 with 1 Axes>
  59. 10.1 Investigation of the Month 12 Churn Spike

    During tenure-based churn analysis, an unusually high churn percentage was observed during subscription tenure month 12.

    The results showed:

    • Customers reaching tenure month 12: 987
    • Cancellations during tenure month 12: 323
    • Observed churn rate: 32.73%

    This percentage is considerably higher than the churn rates observed during most other tenure months.

    Initial Hypothesis

    The spike may be associated with annual subscription renewals.

    Customers on annual plans may reconsider their subscriptions around the end of their initial subscription period.

    However, this explanation has not yet been established.

    Further Investigation

    We will examine:

    • Monthly versus annual subscribers reaching tenure month 12.
    • Cancellations across both subscription types.
    • The actual number of days between signup and cancellation.

    This will help determine whether annual subscription renewals are associated with the observed spike.

  60. # Filter customer records belonging to tenure month 12
    tenure_12 = customer_months[
        customer_months["tenure_month"] == 12
    ].copy()
    
    # Group customers by subscription billing type
    # and calculate customer counts and cancellations
    tenure_12_analysis = (
        tenure_12
        .groupby("plan_type")
        .agg(
            # Count customers who reached tenure month 12
            customers=("customer_id", "nunique"),
    
            # Count cancellations during tenure month 12
            cancellations=("churned_this_month", "sum")
        )
        .reset_index()
    )
    
    # Calculate the observed churn percentage for each plan type
    tenure_12_analysis["churn_rate_pct"] = (
        tenure_12_analysis["cancellations"]
        / tenure_12_analysis["customers"]
    ) * 100
    
    # Round the churn percentages
    tenure_12_analysis["churn_rate_pct"] = (
        tenure_12_analysis["churn_rate_pct"].round(2)
    )
    
    # Display the results
    tenure_12_analysis
      plan_type  customers  cancellations  churn_rate_pct
    0    annual        546            300           54.95
    1   monthly        441             23            5.22
  61. # Select customers who cancelled during tenure month 12
    tenure_12_cancelled = tenure_12[
        tenure_12["churned_this_month"]
    ].copy()
    
    # Calculate the number of days between signup and cancellation
    tenure_12_cancelled["days_to_cancel"] = (
        tenure_12_cancelled["churn_date"]
        - tenure_12_cancelled["signup_date"]
    ).dt.days
    
    # Summarize cancellation timing by subscription type
    cancellation_timing = (
        tenure_12_cancelled
        .groupby("plan_type")
        .agg(
            # Count customers who cancelled
            cancelled_customers=("customer_id", "nunique"),
    
            # Calculate median subscription duration before cancellation
            median_days_to_cancel=("days_to_cancel", "median"),
    
            # Calculate average subscription duration before cancellation
            average_days_to_cancel=("days_to_cancel", "mean")
        )
        .round(2)
        .reset_index()
    )
    
    # Display cancellation timing
    cancellation_timing
      plan_type  cancelled_customers  median_days_to_cancel  \
    0    annual                  300                  334.0   
    1   monthly                   23                  336.0   
    
       average_days_to_cancel  
    0                  333.56  
    1                  336.48  
  62. 10.1 Investigation of the Month 12 Churn Spike – Findings

    Further analysis was performed to investigate the unusually high churn percentage observed during subscription tenure month 12.

    1. Churn by Subscription Type

    Annual Plan:

    • Customers reaching tenure month 12: 546
    • Cancellations: 300
    • Churn rate: 54.95%

    Monthly Plan:

    • Customers reaching tenure month 12: 441
    • Cancellations: 23
    • Churn rate: 5.22%

    2. Key Observations

    • Annual subscribers have substantially higher churn during tenure month 12.
    • Annual subscribers account for approximately 92.88% of cancellations during this tenure month.
    • The difference between annual and monthly churn rates is approximately 49.73 percentage points.

    3. Cancellation Timing

    The median duration between signup and cancellation was:

    • Annual subscribers: 334 days.
    • Monthly subscribers: 336 days.

    Although annual subscribers show a substantially higher cancellation rate during tenure month 12, their median cancellation duration is approximately 334 days rather than a full 365 days.

    4. Business Interpretation

    Subscription billing type appears to be strongly associated with the observed month-12 cancellation spike.

    One possible explanation is that annual subscribers reconsider their subscriptions as they approach the end of their first subscription year.

    However, the calendar-based tenure definition does not represent exactly 12 completed months.

    Further investigation is required to compare cancellation dates against actual annual subscription anniversaries before attributing the spike to renewal behaviour.

    Conclusion

    Annual subscribers demonstrate substantially higher observed churn during tenure month 12.

    This is an important pattern that requires further validation using actual signup and cancellation dates.


  63. # Select annual subscribers who cancelled during tenure month 12
    annual_month12 = tenure_12_cancelled[
        tenure_12_cancelled["plan_type"] == "annual"
    ].copy()
    
    # Calculate the expected first annual anniversary
    annual_month12["annual_anniversary"] = (
        annual_month12["signup_date"] + pd.DateOffset(years=1)
    )
    
    # Calculate the difference between actual cancellation
    # and the expected annual anniversary
    annual_month12["days_from_anniversary"] = (
        annual_month12["churn_date"]
        - annual_month12["annual_anniversary"]
    ).dt.days
    
    # Display the first 10 records for inspection
    annual_month12[
        [
            "customer_id",
            "signup_date",
            "annual_anniversary",
            "churn_date",
            "days_from_anniversary"
        ]
    ].head(10)
          customer_id signup_date annual_anniversary churn_date  \
    156             9  2024-08-29         2025-08-29 2025-07-27   
    483            27  2024-11-01         2025-11-01 2025-10-23   
    607            34  2024-09-18         2025-09-18 2025-08-27   
    749            42  2024-07-13         2025-07-13 2025-06-12   
    986            55  2024-10-18         2025-10-18 2025-09-11   
    1201           67  2024-09-12         2025-09-12 2025-08-10   
    1311           73  2024-11-18         2025-11-18 2025-10-20   
    1454           81  2024-10-25         2025-10-25 2025-09-11   
    1633           91  2024-09-20         2025-09-20 2025-08-10   
    1706           95  2024-10-09         2025-10-09 2025-09-15   
    
          days_from_anniversary  
    156                     -33  
    483                      -9  
    607                     -22  
    749                     -31  
    986                     -37  
    1201                    -33  
    1311                    -29  
    1454                    -44  
    1633                    -41  
    1706                    -24  
  64. # Summarize the number of days between cancellation
    # and the expected annual anniversary
    
    anniversary_summary = annual_month12.agg(
        # Calculate the median difference in days
        median_days=("days_from_anniversary", "median"),
    
        # Calculate the average difference in days
        average_days=("days_from_anniversary", "mean"),
    
        # Find the earliest cancellation relative to anniversary
        minimum_days=("days_from_anniversary", "min"),
    
        # Find the latest cancellation relative to anniversary
        maximum_days=("days_from_anniversary", "max")
    )
    
    # Display the anniversary timing summary
    anniversary_summary
                  days_from_anniversary
    median_days              -31.000000
    average_days             -31.436667
    minimum_days             -60.000000
    maximum_days              -5.000000
  65. # Count cancellations occurring before the annual anniversary
    before_anniversary = (
        annual_month12["days_from_anniversary"] < 0
    ).sum()
    
    # Count cancellations occurring on the anniversary
    on_anniversary = (
        annual_month12["days_from_anniversary"] == 0
    ).sum()
    
    # Count cancellations occurring after the anniversary
    after_anniversary = (
        annual_month12["days_from_anniversary"] > 0
    ).sum()
    
    # Display the cancellation distribution
    print("Cancelled before anniversary:", before_anniversary)
    print("Cancelled on anniversary:", on_anniversary)
    print("Cancelled after anniversary:", after_anniversary)
    Cancelled before anniversary: 300
    Cancelled on anniversary: 0
    Cancelled after anniversary: 0
    
  66. 10.2 Annual Subscription Anniversary – Key Findings

    We investigated whether the high churn rate during tenure month 12 was associated with annual subscription anniversaries.

    1. Cancellation Timing

    The analysis included 300 annual subscribers who cancelled during tenure month 12.

    The results showed:

    • Cancelled before anniversary: 300 customers.
    • Cancelled on anniversary: 0 customers.
    • Cancelled after anniversary: 0 customers.
    • Median cancellation timing: 31 days before anniversary.
    • Average cancellation timing: 31.44 days before anniversary.
    • Cancellation range: 5 to 60 days before anniversary.

    2. Key Observation

    All 300 annual subscribers cancelled before their expected first annual anniversary.

    The median cancellation occurred approximately one month before the anniversary.

    3. Business Interpretation

    The concentration of cancellations before the annual anniversary suggests a possible pre-renewal retention opportunity.

    Customers may be reconsidering their subscriptions before their next annual billing period.

    The company could investigate whether renewal reminders, customer engagement and subscription value communication influence these cancellation decisions.

    However, the available data does not establish the actual reason for these cancellations.

    4. Conclusion

    Annual subscribers demonstrate substantially higher churn during tenure month 12, with all observed cancellations occurring before their first annual anniversary.

    This pattern suggests that the period leading up to annual renewal deserves particular attention in customer retention strategies.


  67. # Convert negative anniversary differences into positive
    # days remaining before the expected anniversary
    annual_month12["days_before_anniversary"] = (
        -annual_month12["days_from_anniversary"]
    )
    
    # Group cancellation timing into three intervals
    annual_month12["cancellation_window"] = pd.cut(
        annual_month12["days_before_anniversary"],
        bins=[0, 7, 30, 60],
        labels=["1-7 days", "8-30 days", "31-60 days"]
    )
    
    # Count cancellations in each pre-anniversary interval
    anniversary_windows = (
        annual_month12["cancellation_window"]
        .value_counts(sort=False)
        .reset_index()
    )
    
    # Rename columns for readability
    anniversary_windows.columns = [
        "cancellation_window",
        "customers"
    ]
    
    # Calculate the percentage of cancellations in each interval
    anniversary_windows["percentage"] = (
        anniversary_windows["customers"] / len(annual_month12)
    ) * 100
    
    # Round percentages
    anniversary_windows["percentage"] = (
        anniversary_windows["percentage"].round(2)
    )
    
    # Display the results
    anniversary_windows
      cancellation_window  customers  percentage
    0            1-7 days          4        1.33
    1           8-30 days        135       45.00
    2          31-60 days        161       53.67
  68. 10.3 Annual Cancellation Timing – Pre-Anniversary Analysis

    We further investigated when annual subscribers cancelled relative to their expected first annual anniversary.

    The 300 cancellations during tenure month 12 were grouped into three time intervals.

    1–7 Days Before Anniversary:

    • Customers: 4
    • Percentage: 1.33%

    8–30 Days Before Anniversary:

    • Customers: 135
    • Percentage: 45.00%

    31–60 Days Before Anniversary:

    • Customers: 161
    • Percentage: 53.67%

    Key Observations

    • The largest group of customers cancelled 31–60 days before their expected anniversary.
    • 45% cancelled 8–30 days before their anniversary.
    • Only 1.33% cancelled within the final seven days.
    • Overall, 98.67% cancelled between 8 and 60 days before their expected anniversary.

    Business Interpretation

    The concentration of cancellations before annual subscription anniversaries suggests a potential pre-renewal retention opportunity.

    The membership team could investigate targeted engagement campaigns during the 60 days leading up to annual anniversaries.

    Potential interventions include personalized workout recommendations, subscription value communication and customer feedback collection.

    Conclusion

    Annual subscription cancellations during tenure month 12 are concentrated in the 8–60 day period before the expected first anniversary.

    This period deserves further investigation as a potential customer retention opportunity.


  69. 11. Customer Engagement and Support Analysis

    In this section, we combine the subscriptions and usage datasets to investigate how customer engagement and support interactions relate to churn.

    Business Objectives

    • Analyze customer workout activity.
    • Examine active workout minutes.
    • Understand live class booking behaviour.
    • Investigate customer support interactions.
    • Compare engagement patterns between churned and active customers.

    Key Metrics

    • Average workouts completed per recorded usage month.
    • Average active minutes per recorded usage month.
    • Average live classes booked per recorded usage month.
    • Total recorded support tickets.
    • Number of months with support contact.

    Business Importance

    Customer engagement is an important area to investigate when understanding subscription retention.

    Customers with lower recorded activity may demonstrate different retention patterns compared with more engaged customers.

    Similarly, frequent support interactions may indicate technical problems, service difficulties or other customer concerns.

    Data Limitation

    The usage dataset contains 1,264 missing customer-month records affecting 139 active customers.

    These missing records will not be interpreted as zero activity.

    Engagement metrics will be calculated using recorded usage months, and the data coverage limitation will be considered when interpreting results.

  70. # Group monthly usage records by customer ID
    customer_usage = (
        usage
        .groupby("customer_id")
        .agg(
            # Count the number of recorded usage months
            recorded_months=("month", "nunique"),
    
            # Calculate total completed workouts in recorded months
            total_workouts=("workouts_completed", "sum"),
    
            # Calculate average workouts per recorded month
            avg_workouts_per_month=("workouts_completed", "mean"),
    
            # Calculate average active minutes in recorded months
            # Missing active minutes are excluded from the mean
            avg_minutes_per_month=("minutes_active", "mean"),
    
            # Count months where active minutes were recorded
            months_with_minutes=("minutes_active", "count"),
    
            # Calculate total live classes booked in recorded months
            total_classes_booked=("classes_booked", "sum"),
    
            # Calculate total support tickets in recorded months
            total_support_tickets=("support_tickets", "sum"),
    
            # Count months in which customers contacted support
            months_with_support_contact=(
                "support_tickets",
                lambda x: (x > 0).sum()
            )
        )
        .reset_index()
    )
    
    # Display the customer-level usage summary
    customer_usage.head()
       customer_id  recorded_months  total_workouts  avg_workouts_per_month  \
    0            1               10              46                4.600000   
    1            2                5               4                0.800000   
    2            3                1               0                0.000000   
    3            4                1               2                2.000000   
    4            5                7               9                1.285714   
    
       avg_minutes_per_month  months_with_minutes  total_classes_booked  \
    0             133.400000                   10                     0   
    1              25.000000                    5                     0   
    2               0.000000                    1                     0   
    3              80.000000                    1                     0   
    4              49.833333                    6                     0   
    
       total_support_tickets  months_with_support_contact  
    0                      6                            3  
    1                      0                            0  
    2                      0                            0  
    3                      1                            1  
    4                      1                            1  
  71. # Combine customer subscription information with aggregated usage metrics
    customer_analysis = subscriptions.merge(
        customer_usage,
        on="customer_id",
        how="left",
        validate="one_to_one",
        indicator=True
    )
    
    # Check whether all subscription customers matched with usage data
    print(customer_analysis["_merge"].value_counts())
    
    # Check the final dataset dimensions
    print("\nFinal customer analysis shape:")
    print(customer_analysis.shape)
    
    # Display the combined dataset
    customer_analysis.head()
    _merge
    both          4200
    left_only        0
    right_only       0
    Name: count, dtype: int64
    
    Final customer analysis shape:
    (4200, 20)
    
       customer_id signup_date plan_type plan_tier  monthly_price  \
    0            1  2024-09-11   monthly     basic          12.99   
    1            2  2025-08-14    annual     basic           9.74   
    2            3  2025-01-24   monthly     basic          12.99   
    3            4  2024-08-15   monthly     basic          12.99   
    4            5  2025-06-24    annual      plus          14.99   
    
      acquisition_channel primary_device age_group churned churn_date  \
    0         promo_offer        android     45-54     yes 2025-06-29   
    1         promo_offer            web     45-54      no        NaT   
    2            referral            ios       55+      no        NaT   
    3         paid_social            ios     25-34     yes 2024-08-20   
    4         paid_social        android       55+      no        NaT   
    
          cancel_reason  recorded_months  total_workouts  avg_workouts_per_month  \
    0  technical_issues               10              46                4.600000   
    1    not_applicable                5               4                0.800000   
    2    not_applicable                1               0                0.000000   
    3  not_using_enough                1               2                2.000000   
    4    not_applicable                7               9                1.285714   
    
       avg_minutes_per_month  months_with_minutes  total_classes_booked  \
    0             133.400000                   10                     0   
    1              25.000000                    5                     0   
    2               0.000000                    1                     0   
    3              80.000000                    1                     0   
    4              49.833333                    6                     0   
    
       total_support_tickets  months_with_support_contact _merge  
    0                      6                            3   both  
    1                      0                            0   both  
    2                      0                            0   both  
    3                      1          
  72. 11.1 Combining Subscription and Usage Data

    The subscriptions and usage datasets were successfully combined using customer_id.

    Before merging, the monthly usage records were aggregated into customer-level engagement metrics.

    Merge Validation Results

    • Total subscription customers: 4,200.
    • Customers matched in both datasets: 4,200.
    • Subscription customers without a usage match: 0.
    • Unexpected usage customers: 0.
    • Final combined dataset: 4,200 rows and 20 columns.

    Key Observation

    Every customer in the subscription dataset has at least one corresponding usage record.

    However, previous investigation identified incomplete monthly usage histories for 139 active customers.

    Therefore, a successful customer-level merge does not necessarily indicate complete monthly engagement data.

    Conclusion

    The customer-level dataset was successfully created and is ready for engagement and support analysis.

    Engagement metrics will be interpreted using recorded usage months, while the previously identified data coverage limitation will be considered.

  73. # Remove the merge indicator because we have already validated the merge
    customer_analysis = customer_analysis.drop(columns="_merge")
    
    # Calculate average live classes booked per recorded usage month
    customer_analysis["avg_classes_per_month"] = (
        customer_analysis["total_classes_booked"]
        / customer_analysis["recorded_months"]
    )
    
    # Calculate average support tickets per recorded usage month
    customer_analysis["avg_support_tickets_per_month"] = (
        customer_analysis["total_support_tickets"]
        / customer_analysis["recorded_months"]
    )
    
    # Check the newly created metrics
    customer_analysis[
        [
            "customer_id",
            "recorded_months",
            "avg_workouts_per_month",
            "avg_minutes_per_month",
            "avg_classes_per_month",
            "avg_support_tickets_per_month"
        ]
    ].head()
       customer_id  recorded_months  avg_workouts_per_month  \
    0            1               10                4.600000   
    1            2                5                0.800000   
    2            3                1                0.000000   
    3            4                1                2.000000   
    4            5                7                1.285714   
    
       avg_minutes_per_month  avg_classes_per_month  avg_support_tickets_per_month  
    0             133.400000                    0.0                       0.600000  
    1              25.000000                    0.0                       0.000000  
    2               0.000000                    0.0                       0.000000  
    3              80.000000                    0.0                       1.000000  
    4              49.833333                    0.0                       0.142857  
  74. # Group customers according to their churn status
    engagement_by_churn = (
        customer_analysis
        .groupby("churned")
        .agg(
            # Count customers in each churn category
            customers=("customer_id", "nunique"),
    
            # Calculate average and median monthly workouts per customer
            avg_workouts=("avg_workouts_per_month", "mean"),
            median_workouts=("avg_workouts_per_month", "median"),
    
            # Calculate average and median active minutes
            avg_minutes=("avg_minutes_per_month", "mean"),
            median_minutes=("avg_minutes_per_month", "median"),
    
            # Calculate average monthly live classes booked
            avg_classes=("avg_classes_per_month", "mean"),
    
            # Calculate average monthly support tickets
            avg_support_tickets=("avg_support_tickets_per_month", "mean"),
    
            # Count customers who contacted support at least once
            customers_with_support=(
                "total_support_tickets",
                lambda x: (x > 0).sum()
            ),
    
            # Count customers with at least one recorded active-minute value
            customers_with_minutes_data=(
                "months_with_minutes",
                lambda x: (x > 0).sum()
            )
        )
        .round(2)
        .reset_index()
    )
    
    # Display engagement comparisons
    engagement_by_churn
      churned  customers  avg_workouts  median_workouts  avg_minutes  \
    0      no       2432          4.90             4.12       147.25   
    1     yes       1768          2.94             2.00        88.31   
    
       median_minutes  avg_classes  avg_support_tickets  customers_with_support  \
    0          123.26         0.79                 0.12                    1111   
    1           62.14         0.48                 0.14                     778   
    
       customers_with_minutes_data  
    0                         2428  
    1                         1761  
  75. # Set the chart dimensions
    plt.figure(figsize=(8, 5))
    
    # Compare average workouts per recorded month by churn status
    sns.barplot(
        data=customer_analysis,
        x="churned",
        y="avg_workouts_per_month"
    )
    
    # Add chart title and axis labels
    plt.title("Average Monthly Workouts by Customer Churn Status")
    plt.xlabel("Customer Churn Status")
    plt.ylabel("Average Workouts per Recorded Month")
    
    # Display the chart
    plt.show()
    Chart produced by this cell
    <Figure size 800x500 with 1 Axes>
  76. 11.1 Customer Engagement Comparison – Preliminary Findings

    We compared customer engagement metrics between active and churned subscribers.

    1. Workout Activity

    • Active customers completed an average of 4.90 workouts per recorded month.
    • Churned customers completed an average of 2.94 workouts per recorded month.

    Active customers also had a higher median workout count.

    2. Active Workout Minutes

    • Active customers recorded an average of 147.25 active minutes per recorded month.
    • Churned customers recorded an average of 88.31 active minutes per recorded month.

    This indicates lower recorded workout duration among churned customers.

    3. Live Class Bookings

    • Active customers averaged 0.79 live classes booked per recorded month.
    • Churned customers averaged 0.48.

    These results should be interpreted carefully because Basic subscribers cannot book live classes.

    4. Customer Support

    • Active customers averaged 0.12 support tickets per recorded month.
    • Churned customers averaged 0.14.

    The difference is relatively small.

    Key Observation

    Churned customers demonstrate lower average recorded workout activity and workout duration compared with active customers.

    Business Interpretation

    Lower engagement may be associated with customer churn.

    Customers who participate in fewer workouts may be less connected to the fitness platform.

    However, these comparisons do not establish causation, and incomplete usage histories may influence the results.

    Data Limitation

    The usage dataset contains 1,264 missing customer-month records affecting 139 active customers.

    Engagement metrics are calculated using recorded usage months rather than complete subscription histories.

    Further validation using customers with complete usage coverage and first-month engagement analysis is required before drawing final conclusions.

  77. # Count the expected subscribed months for every customer
    # using the customer-month dataset
    
    expected_usage = (
        customer_months
        .groupby("customer_id")
        .agg(
            expected_months=("month", "nunique")
        )
        .reset_index()
    )
    
    # Display the first few customer records
    expected_usage.head()
       customer_id  expected_months
    0            1               10
    1            2                5
    2            3               12
    3            4                1
    4            5                7
  78. # Attach the expected usage months to the customer analysis dataset
    
    customer_analysis = customer_analysis.merge(
        expected_usage,
        on="customer_id",
        how="left",
        validate="one_to_one"
    )
    
    # Calculate the percentage of expected months with recorded usage
    customer_analysis["usage_coverage_pct"] = (
        customer_analysis["recorded_months"]
        / customer_analysis["expected_months"]
    ) * 100
    
    # Classify customers according to their usage coverage
    customer_analysis["usage_coverage_status"] = np.where(
        customer_analysis["recorded_months"]
        == customer_analysis["expected_months"],
        "complete",
        "incomplete"
    )
    
    # Round coverage percentages
    customer_analysis["usage_coverage_pct"] = (
        customer_analysis["usage_coverage_pct"].round(2)
    )
  79. # Count customers with complete and incomplete usage histories
    print(
        customer_analysis["usage_coverage_status"].value_counts()
    )
    
    # Compare coverage status across churn groups
    print("\nCoverage by churn status:")
    
    print(
        customer_analysis.groupby(
            ["churned", "usage_coverage_status"]
        )["customer_id"].nunique()
    )
    usage_coverage_status
    complete      4061
    incomplete     139
    Name: count, dtype: int64
    
    Coverage by churn status:
    churned  usage_coverage_status
    no       complete                 2293
             incomplete                139
    yes      complete                 1768
    Name: customer_id, dtype: int64
    
  80. # Display customers with incomplete usage histories
    incomplete_customers = customer_analysis[
        customer_analysis["usage_coverage_status"] == "incomplete"
    ]
    
    # Inspect their subscription status and usage coverage
    incomplete_customers[
        [
            "customer_id",
            "churned",
            "recorded_months",
            "expected_months",
            "usage_coverage_pct"
        ]
    ].head(10)
         customer_id churned  recorded_months  expected_months  usage_coverage_pct
    2              3      no                1               12                8.33
    36            37      no                1               13                7.69
    44            45      no                1                6               16.67
    56            57      no                1               13                7.69
    143          144      no                1               17                5.88
    158          159      no                1               13                7.69
    177          178      no                1               11                9.09
    178          179      no                1               13                7.69
    180          181      no                1               17                5.88
    207          208      no                1                9               11.11
  81. 11.2 Usage Coverage Validation – Findings

    We compared the expected subscription months with the actual recorded usage months for all customers.

    1. Coverage Distribution

    Coverage StatusCustomers
    Complete4,061
    Incomplete139
    Total4,200

    Approximately 96.69% of customers have complete usage-record coverage.

    2. Coverage by Churn Status

    Active Customers:

    • Complete coverage: 2,293.
    • Incomplete coverage: 139.

    Churned Customers:

    • Complete coverage: 1,768.
    • Incomplete coverage: 0.

    3. Key Observations

    • All churned customers have complete usage-record coverage.
    • 139 active customers have incomplete usage histories.
    • The 139 affected customers have only one recorded usage month, corresponding to their signup month.
    • Approximately 5.72% of active customers have incomplete usage coverage.

    4. Business Implication

    Incomplete usage histories may influence customer engagement averages.

    The initial engagement comparison included all customers, meaning some active customers were represented by only one recorded usage month.

    Conclusion

    A sensitivity analysis will be performed using customers with complete usage-record coverage.

    This will help determine whether the differences in engagement between active and churned customers remain consistent after excluding customers with incomplete monthly usage records.

    The original customer-level dataset will be preserved.

  82. # Create a separate dataset containing only customers
    # whose recorded usage months match their expected usage months
    
    complete_coverage_analysis = customer_analysis[
        customer_analysis["usage_coverage_status"] == "complete"
    ].copy()
    
    # Check the number of customers retained
    print("Complete coverage customers:",
          complete_coverage_analysis.shape[0])
    
    # Check the distribution of churn status
    print("\nChurn status distribution:")
    
    print(
        complete_coverage_analysis["churned"].value_counts()
    )
    Complete coverage customers: 4061
    
    Churn status distribution:
    churned
    no     2293
    yes    1768
    Name: count, dtype: int64
    
  83. # Calculate how many expected recorded months
    # do not have a recorded active-minute value for each customer
    
    complete_coverage_analysis["missing_minute_months"] = (
        complete_coverage_analysis["recorded_months"]
        - complete_coverage_analysis["months_with_minutes"]
    )
    
    # Compare missing active-minute records by churn status
    minute_quality_by_churn = (
        complete_coverage_analysis
        .groupby("churned")
        .agg(
            # Count customers in each churn group
            customers=("customer_id", "nunique"),
    
            # Count customers with missing active-minute records
            customers_with_missing_minutes=(
                "missing_minute_months",
                lambda x: (x > 0).sum()
            ),
    
            # Count total missing active-minute records
            missing_minute_records=(
                "missing_minute_months",
                "sum"
            )
        )
        .reset_index()
    )
    
    # Display missing-minute information
    minute_quality_by_churn
      churned  customers  customers_with_missing_minutes  missing_minute_records
    0      no       2293                             302                     319
    1     yes       1768                             168                     180
  84. # Group complete-coverage customers by churn status
    engagement_complete = (
        complete_coverage_analysis
        .groupby("churned")
        .agg(
            # Count customers in each churn category
            customers=("customer_id", "nunique"),
    
            # Calculate average workouts per recorded month
            avg_workouts=("avg_workouts_per_month", "mean"),
    
            # Calculate median workouts per recorded month
            median_workouts=("avg_workouts_per_month", "median"),
    
            # Calculate average active minutes
            avg_minutes=("avg_minutes_per_month", "mean"),
    
            # Calculate median active minutes
            median_minutes=("avg_minutes_per_month", "median"),
    
            # Calculate average live classes booked per month
            avg_classes=("avg_classes_per_month", "mean"),
    
            # Calculate average support tickets per month
            avg_support_tickets=(
                "avg_support_tickets_per_month",
                "mean"
            )
        )
        .round(2)
        .reset_index()
    )
    
    # Display the new engagement comparison
    engagement_complete
      churned  customers  avg_workouts  median_workouts  avg_minutes  \
    0      no       2293          5.08             4.33       152.10   
    1     yes       1768          2.94             2.00        88.31   
    
       median_minutes  avg_classes  avg_support_tickets  
    0          127.75         0.81                 0.11  
    1           62.14         0.48                 0.14  
  85. # Add labels to distinguish the two analyses
    # Original analysis includes all 4,200 customers
    original_comparison = engagement_by_churn.copy()
    original_comparison["analysis_group"] = "all_customers"
    
    # Complete-coverage analysis includes 4,061 customers
    complete_comparison = engagement_complete.copy()
    complete_comparison["analysis_group"] = "complete_coverage"
    
    # Combine both comparison tables
    engagement_sensitivity = pd.concat(
        [original_comparison, complete_comparison],
        ignore_index=True
    )
    
    # Display the comparison
    engagement_sensitivity[
        [
            "analysis_group",
            "churned",
            "customers",
            "avg_workouts",
            "avg_minutes",
            "avg_classes",
            "avg_support_tickets"
        ]
    ]
          analysis_group churned  customers  avg_workouts  avg_minutes  \
    0      all_customers      no       2432          4.90       147.25   
    1      all_customers     yes       1768          2.94        88.31   
    2  complete_coverage      no       2293          5.08       152.10   
    3  complete_coverage     yes       1768          2.94        88.31   
    
       avg_classes  avg_support_tickets  
    0         0.79                 0.12  
    1         0.48                 0.14  
    2         0.81                 0.11  
    3         0.48                 0.14  
  86. 11.3 Engagement Sensitivity Analysis – Key Findings

    To validate the initial engagement findings, we repeated the analysis using only customers with complete usage-record coverage.

    The analysis included 4,061 customers:

    • Active customers: 2,293.
    • Churned customers: 1,768.

    1. Workout Engagement

    • Active customers averaged 5.08 workouts per recorded month.
    • Churned customers averaged 2.94 workouts per recorded month.

    The difference remained substantial after excluding customers with incomplete usage histories.

    2. Active Workout Minutes

    • Active customers averaged 152.10 active minutes.
    • Churned customers averaged 88.31 active minutes.

    The difference remained consistent, although missing active-minute measurements still require consideration.

    3. Live Class Bookings

    • Active customers averaged 0.81 classes booked per recorded month.
    • Churned customers averaged 0.48.

    These results require further investigation because Basic subscribers cannot book live classes.

    4. Customer Support

    • Active customers averaged 0.11 support tickets per recorded month.
    • Churned customers averaged 0.14.

    The difference was relatively small.

    Conclusion

    The lower workout engagement observed among churned customers remained consistent after restricting the analysis to customers with complete usage-record coverage.

    This strengthens the observed association between workout frequency and churn.

    However, these comparisons do not establish causation. Additional tenure-adjusted and first-month engagement analysis is required.


  87. 12. Customer Support Analysis

    In this section, we investigate the relationship between customer support interactions and subscription churn.

    Business Objectives

    • Identify how many customers contacted support.
    • Calculate the percentage of customers who contacted support.
    • Compare support ticket frequency between active and churned customers.
    • Examine the frequency of support contact across recorded subscription months.

    Business Importance

    Frequent customer support interactions may indicate technical difficulties, service problems or customer dissatisfaction.

    Understanding these interactions may help the membership team identify potential customer retention opportunities.

    We will compare support behaviour between active and churned customers using customers with complete usage-record coverage.

  88. # Group complete-coverage customers by churn status
    support_by_churn = (
        complete_coverage_analysis
        .groupby("churned")
        .agg(
            # Count customers in each churn category
            total_customers=("customer_id", "nunique"),
    
            # Count customers who raised at least one support ticket
            customers_with_support=(
                "total_support_tickets",
                lambda x: (x > 0).sum()
            ),
    
            # Calculate total support tickets
            total_tickets=("total_support_tickets", "sum"),
    
            # Calculate average tickets per recorded month
            avg_tickets_per_month=(
                "avg_support_tickets_per_month",
                "mean"
            ),
    
            # Calculate average total tickets per customer
            avg_tickets_per_customer=(
                "total_support_tickets",
                "mean"
            ),
    
            # Calculate average months with support contact
            avg_support_months=(
                "months_with_support_contact",
                "mean"
            )
        )
        .reset_index()
    )
    
    # Calculate the percentage of customers who contacted support
    support_by_churn["support_contact_pct"] = (
        support_by_churn["customers_with_support"]
        / support_by_churn["total_customers"]
    ) * 100
    
    # Round numerical results to two decimal places
    support_by_churn = support_by_churn.round(2)
    
    # Display the support analysis
    support_by_churn
      churned  total_customers  customers_with_support  total_tickets  \
    0      no             2293                    1085           2372   
    1     yes             1768                     778           1515   
    
       avg_tickets_per_month  avg_tickets_per_customer  avg_support_months  \
    0                   0.11                      1.03                0.94   
    1                   0.14                      0.86                0.78   
    
       support_contact_pct  
    0                47.32  
    1                44.00  
  89. # Set chart dimensions
    plt.figure(figsize=(8, 5))
    
    # Compare the percentage of customers who contacted support
    sns.barplot(
        data=support_by_churn,
        x="churned",
        y="support_contact_pct"
    )
    
    # Add title and axis labels
    plt.title("Customer Support Contact Rate by Churn Status")
    plt.xlabel("Customer Churn Status")
    plt.ylabel("Customers Contacting Support (%)")
    
    # Display the chart
    plt.show()
    Chart produced by this cell
    <Figure size 800x500 with 1 Axes>
  90. # Set chart dimensions
    plt.figure(figsize=(8, 5))
    
    # Compare average support tickets per recorded month
    sns.barplot(
        data=support_by_churn,
        x="churned",
        y="avg_tickets_per_month"
    )
    
    # Add title and axis labels
    plt.title("Average Monthly Support Tickets by Churn Status")
    plt.xlabel("Customer Churn Status")
    plt.ylabel("Average Support Tickets per Recorded Month")
    
    # Display the chart
    plt.show()
    Chart produced by this cell
    <Figure size 800x500 with 1 Axes>
  91. 12.1 Customer Support Analysis – Key Findings

    The analysis compared customer support interactions between active and churned subscribers.

    1. Support Contact Percentage

    Active Customers:

    • Total customers: 2,293
    • Customers contacting support: 1,085
    • Support contact percentage: 47.32%

    Churned Customers:

    • Total customers: 1,768
    • Customers contacting support: 778
    • Support contact percentage: 44.00%

    2. Support Ticket Frequency

    • Active customers averaged 0.11 support tickets per recorded month.
    • Churned customers averaged 0.14 support tickets per recorded month.

    3. Average Support Tickets per Customer

    • Active customers averaged 1.03 tickets per customer.
    • Churned customers averaged 0.86 tickets per customer.

    Key Observations

    • A higher percentage of active customers contacted support.
    • Churned customers had slightly higher average monthly support-ticket frequency.
    • Active customers had a higher average total number of tickets per customer.

    Business Interpretation

    The relationship between customer support interactions and churn is not straightforward.

    Although churned customers had slightly higher monthly ticket frequency, a greater percentage of active customers contacted support.

    The results do not establish that support interactions are a strong churn driver.

    Further investigation of support issues, customer complaints and cancellation reasons may provide additional context.

    Conclusion

    Customer support activity shows some differences between active and churned customers, but the available evidence does not establish a strong relationship between support contact and churn.


  92. 13. First-Month Customer Engagement Analysis

    In this section, we investigate customer engagement during the first calendar month of their subscription.

    Business Objectives

    • Identify each customer's first subscription month.
    • Calculate first-month workouts, active minutes and live classes booked.
    • Examine support interactions during the first month.
    • Compare early engagement between customers who eventually churned and those who remained active.

    Business Importance

    The first subscription month is an important stage in the customer lifecycle.

    Customers who do not engage with the platform early may have difficulty developing consistent workout habits.

    Understanding first-month behaviour can help the membership team identify potential opportunities for onboarding improvements and early retention campaigns.

    Analysis Limitation

    The first month is defined as the calendar month in which a customer signed up.

    Since the usage dataset contains monthly aggregated information, we cannot identify the exact dates when workouts occurred within that month.

    Customers who cancelled during their signup month will therefore be examined carefully, as the data cannot establish whether their recorded activity occurred before or after cancellation.

  93. # Create a separate copy of subscription information
    first_month_customers = subscriptions[
        ["customer_id", "signup_date", "churned", "churn_date"]
    ].copy()
    
    # Convert the signup date into a monthly period
    first_month_customers["signup_month"] = (
        first_month_customers["signup_date"].dt.to_period("M")
    )
    
    # Create a copy of usage data for first-month analysis
    first_month_data = usage.copy()
    
    # Convert usage dates into monthly periods
    first_month_data["usage_month"] = (
        first_month_data["month"].dt.to_period("M")
    )
    
    # Match each customer with their signup-month usage record
    first_month_analysis = first_month_customers.merge(
        first_month_data,
        left_on=["customer_id", "signup_month"],
        right_on=["customer_id", "usage_month"],
        how="left",
        validate="one_to_one",
        indicator=True
    )
    
    # Check whether all customers have a signup-month usage record
    print(first_month_analysis["_merge"].value_counts())
    
    # Display the first-month dataset
    first_month_analysis.head()
    _merge
    both          4200
    left_only        0
    right_only       0
    Name: count, dtype: int64
    
       customer_id signup_date churned churn_date signup_month      month  \
    0            1  2024-09-11     yes 2025-06-29      2024-09 2024-09-01   
    1            2  2025-08-14      no        NaT      2025-08 2025-08-01   
    2            3  2025-01-24      no        NaT      2025-01 2025-01-01   
    3            4  2024-08-15     yes 2024-08-20      2024-08 2024-08-01   
    4            5  2025-06-24      no        NaT      2025-06 2025-06-01   
    
       workouts_completed  minutes_active  classes_booked  support_tickets  \
    0                   5           140.0               0                0   
    1                   2            58.0               0                0   
    2                   0             0.0               0                0   
    3                   2            80.0               0                1   
    4                   3            79.0               0                0   
    
      usage_month _merge  
    0     2024-09   both  
    1     2025-08   both  
    2     2025-01   both  
    3     2024-08   both  
    4     2025-06   both  
  94. # Identify customers who cancelled during their signup calendar month
    first_month_analysis["churned_in_signup_month"] = (
        first_month_analysis["churn_date"].notna()
        &
        (
            first_month_analysis["churn_date"].dt.to_period("M")
            == first_month_analysis["signup_month"]
        )
    )
    
    # Count customers who cancelled during their signup month
    print(
        first_month_analysis["churned_in_signup_month"].value_counts()
    )
    churned_in_signup_month
    False    4049
    True      151
    Name: count, dtype: int64
    
  95. # Group first-month engagement metrics by eventual churn status
    first_month_engagement = (
        first_month_analysis
        .groupby("churned")
        .agg(
            # Count customers in each churn category
            customers=("customer_id", "nunique"),
    
            # Calculate average first-month workouts
            avg_workouts=("workouts_completed", "mean"),
    
            # Calculate median first-month workouts
            median_workouts=("workouts_completed", "median"),
    
            # Calculate average first-month active minutes
            avg_minutes=("minutes_active", "mean"),
    
            # Calculate average first-month live classes
            avg_classes=("classes_booked", "mean"),
    
            # Calculate average first-month support tickets
            avg_support_tickets=("support_tickets", "mean"),
    
            # Count customers with missing active-minute measurements
            missing_minutes=("minutes_active", lambda x: x.isna().sum())
        )
        .round(2)
        .reset_index()
    )
    
    # Display first-month engagement comparisons
    first_month_engagement
      churned  customers  avg_workouts  median_workouts  avg_minutes  avg_classes  \
    0      no       2432          4.67              4.0       139.32         0.74   
    1     yes       1768          3.03              2.0        91.10         0.51   
    
       avg_support_tickets  missing_minutes  
    0                 0.09               42  
    1                 0.10               29  
  96. 13.1 First-Month Customer Engagement – Initial Findings

    We compared customer engagement during the signup calendar month between active and churned subscribers.

    1. Workout Engagement

    • Active customers completed an average of 4.67 workouts.
    • Churned customers completed an average of 3.03 workouts.

    2. Active Workout Minutes

    • Active customers recorded an average of 139.32 active minutes.
    • Churned customers recorded an average of 91.10 active minutes.

    3. Live Class Bookings

    • Active customers averaged 0.74 classes booked.
    • Churned customers averaged 0.51 classes booked.

    4. Customer Support

    • Active customers averaged 0.09 support tickets.
    • Churned customers averaged 0.10 support tickets.

    Key Observation

    Customers who eventually churned demonstrated lower average workout activity and fewer live class bookings during their signup calendar month.

    Important Data Limitation

    A total of 151 customers cancelled during their signup calendar month.

    Because the usage data is aggregated by calendar month, the exact timing of workouts relative to cancellation cannot be established.

    Additionally, the signup calendar month may represent different exposure durations for different customers.

    Conclusion

    The initial results indicate an association between lower first-month engagement and eventual churn.

    Further analysis will separate same-month cancellations from customers who cancelled after their signup month before drawing conclusions about early engagement and retention.

  97. # Create a new column to classify customers by cancellation timing
    
    first_month_analysis["churn_timing"] = np.select(
    
        # Define the conditions for each customer group
        [
            first_month_analysis["churned_in_signup_month"],
    
            (
                (first_month_analysis["churned"] == "yes")
                &
                (~first_month_analysis["churned_in_signup_month"])
            )
        ],
    
        # Assign labels to the corresponding conditions
        [
            "same_month_churn",
            "later_churn"
        ],
    
        # Customers who do not match either condition are still active
        default="still_active"
    )
    
    # Check the number of customers in each group
    print(first_month_analysis["churn_timing"].value_counts())
    churn_timing
    still_active        2432
    later_churn         1617
    same_month_churn     151
    Name: count, dtype: int64
    
  98. # Group customers by their cancellation timing
    first_month_comparison = (
        first_month_analysis
        .groupby("churn_timing")
        .agg(
    
            # Count customers in each group
            customers=("customer_id", "nunique"),
    
            # Calculate average first-month workouts
            avg_workouts=("workouts_completed", "mean"),
    
            # Calculate median first-month workouts
            median_workouts=("workouts_completed", "median"),
    
            # Calculate average first-month active minutes
            avg_minutes=("minutes_active", "mean"),
    
            # Calculate average first-month live classes booked
            avg_classes=("classes_booked", "mean"),
    
            # Calculate average first-month support tickets
            avg_support_tickets=("support_tickets", "mean")
        )
    
        # Round numerical results to two decimal places
        .round(2)
    
        # Convert churn timing back into a regular column
        .reset_index()
    )
    
    # Display the comparison
    first_month_comparison
           churn_timing  customers  avg_workouts  median_workouts  avg_minutes  \
    0       later_churn       1617          3.11              2.0        93.49   
    1  same_month_churn        151          2.17              1.0        64.81   
    2      still_active       2432          4.67              4.0       139.32   
    
       avg_classes  avg_support_tickets  
    0         0.51                 0.09  
    1         0.41                 0.21  
    2         0.74                 0.09  
  99. # Define the customer group order
    group_order = [
        "still_active",
        "later_churn",
        "same_month_churn"
    ]
    
    # Set the chart dimensions
    plt.figure(figsize=(9, 5))
    
    # Compare average first-month workouts across customer groups
    sns.barplot(
        data=first_month_comparison,
        x="churn_timing",
        y="avg_workouts",
        order=group_order
    )
    
    # Add chart title and axis labels
    plt.title("First-Month Workouts by Customer Cancellation Timing")
    plt.xlabel("Customer Group")
    plt.ylabel("Average First-Month Workouts")
    
    # Rotate labels for better readability
    plt.xticks(rotation=15)
    
    # Display the chart
    plt.tight_layout()
    plt.show()
    Chart produced by this cell
    <Figure size 900x500 with 1 Axes>
  100. 13.2 First-Month Engagement – Customer Cancellation Timing Findings

    Customers were divided into three groups based on their subscription cancellation timing.

    1. Still Active Customers

    • Customers: 2,432
    • Average first-month workouts: 4.67
    • Median first-month workouts: 4
    • Average active minutes: 139.32
    • Average live classes: 0.74

    2. Later Churn Customers

    • Customers: 1,617
    • Average first-month workouts: 3.11
    • Median first-month workouts: 2
    • Average active minutes: 93.49
    • Average live classes: 0.51

    3. Same-Month Churn Customers

    • Customers: 151
    • Average first-month workouts: 2.17
    • Median first-month workouts: 1
    • Average active minutes: 64.81
    • Average live classes: 0.41

    Key Observations

    • Customers who eventually churned completed fewer workouts during their signup month.
    • Later churn customers completed approximately 33.4% fewer workouts than active customers.
    • Same-month churn customers demonstrated the lowest average workout engagement.
    • Support-ticket frequency was highest among same-month churn customers.

    Business Interpretation

    Lower early workout engagement may be associated with a greater likelihood of eventual subscription cancellation.

    This suggests that improving onboarding, encouraging workout consistency and helping customers discover relevant classes could be valuable retention opportunities.

    Data Limitations

    The first month represents the signup calendar month rather than a full 30-day period.

    Customers who cancelled during their signup month may have recorded activity both before and after cancellation, because exact workout dates are unavailable.

    Conclusion

    The findings support an association between lower first-month engagement and subsequent customer churn.

    Further tenure-adjusted analysis is required before identifying early engagement as a confirmed churn driver.


  101. 14. Tenure-Adjusted Churn Driver Analysis

    In this section, we validate potential customer churn drivers while accounting for differences in subscription tenure.

    Business Objective

    Determine whether the customer characteristics and engagement patterns identified during exploratory analysis remain associated with churn when customers are compared at similar subscription tenure stages.

    Potential Churn Drivers

    • Subscription type
    • Acquisition channel
    • Primary device
    • Customer engagement

    Analysis Approach

    We will use the customer-month dataset to compare monthly cancellations against customers active during the same tenure month.

    This allows us to examine whether observed differences between customer groups remain consistent across subscription stages.

    Business Importance

    Customers who have subscribed for different lengths of time should not be compared without considering their exposure to cancellation risk.

    Tenure-adjusted analysis will help identify more reliable customer retention patterns and support evidence-based recommendations.

  102. # Check that each customer appears only once per tenure month
    print(
        "Duplicate customer-tenure records:",
        customer_months.duplicated(
            subset=["customer_id", "tenure_month"]
        ).sum()
    )
    
    # Check the total number of customer-month records
    print(
        "Total customer-month records:",
        customer_months.shape[0]
    )
    
    # Check how many customers are represented
    print(
        "Unique customers:",
        customer_months["customer_id"].nunique()
    )
    Duplicate customer-tenure records: 0
    Total customer-month records: 31789
    Unique customers: 4200
    
  103. 14.1 Customer-Tenure Dataset Validation

    Before performing tenure-adjusted churn analysis, we validated the customer-month dataset.

    The validation produced the following results:

    • Total customer-month records: 31,789.
    • Unique customers: 4,200.
    • Duplicate customer-tenure combinations: 0.

    Conclusion

    The customer-month dataset contains unique customer-tenure combinations and is ready for tenure-based churn comparisons.


  104. 14.2 Tenure-Adjusted Churn by Subscription Type

    In this section, we compare monthly and annual subscription churn across the same customer-tenure periods.

    Business Objectives

    • Calculate active customers and cancellations for each subscription type at every tenure month.
    • Calculate churn percentages separately for monthly and annual subscribers.
    • Compare the two subscription types at equivalent tenure stages.
    • Identify tenure periods with substantial differences in cancellation behaviour.

    Business Importance

    Overall cumulative churn percentages can be misleading when customers have different subscription durations.

    Comparing customers within the same tenure month provides a fairer understanding of differences in subscription retention.

    This analysis will help determine whether subscription type remains associated with churn after accounting for customer tenure.

    Analysis Approach

    We will group the customer-month dataset by subscription type and tenure month.

    Monthly cancellations will be divided by the number of customers who reached the corresponding tenure month.

    The resulting percentages will be compared across monthly and annual subscriptions.

  105. # Group customers by subscription type and tenure month
    plan_tenure_churn = (
        customer_months
        .groupby(["tenure_month", "plan_type"])
        .agg(
    
            # Count unique customers who reached each tenure month
            customers=("customer_id", "nunique"),
    
            # Count customers who cancelled during that tenure month
            cancellations=("churned_this_month", "sum")
        )
        .reset_index()
    )
    
    # Calculate the churn percentage for each plan type and tenure month
    plan_tenure_churn["churn_rate_pct"] = (
        plan_tenure_churn["cancellations"]
        / plan_tenure_churn["customers"]
    ) * 100
    
    # Round churn percentages to two decimal places
    plan_tenure_churn["churn_rate_pct"] = (
        plan_tenure_churn["churn_rate_pct"].round(2)
    )
    
    # Display the results
    plan_tenure_churn
        tenure_month plan_type  customers  cancellations  churn_rate_pct
    0              1    annual       1539              9            0.58
    1              1   monthly       2661            142            5.34
    2              2    annual       1530             12            0.78
    3              2   monthly       2519            207            8.22
    4              3    annual       1518              7            0.46
    5              3   monthly       2312            277           11.98
    6              4    annual       1391             13            0.93
    7              4   monthly       1899            190           10.01
    8              5    annual       1256             11            0.88
    9              5   monthly       1593            120            7.53
    10             6    annual       1144             11            0.96
    11             6   monthly       1345             83            6.17
    12             7    annual       1026             13            1.27
    13             7   monthly       1167             70            6.00
    14             8    annual        933              8            0.86
    15             8   monthly        983             63            6.41
    16             9    annual        820              7            0.85
    17             9   monthly        833             52            6.24
    18            10    annual        724              7            0.97
    19            10   monthly        690             44            6.38
    20            11    annual        631              5            0.79
    21            11   monthly        555             36            6.49
    22            12    annual        546            300           54.95
    23            12   monthly        441             23            5.22
    24            13    annual        208              1            0.48
    25            13   monthly        346             17            4.91
    26            14    annual        164              0            0.00
    27            14   monthly        264             16            6.06
  106. # Convert the grouped results into a comparison table
    # with separate columns for annual and monthly subscriptions
    
    plan_tenure_comparison = (
        plan_tenure_churn
        .pivot(
            index="tenure_month",
            columns="plan_type",
            values="churn_rate_pct"
        )
        .reset_index()
    )
    
    # Display the tenure-wise comparison
    plan_tenure_comparison
    plan_type  tenure_month  annual  monthly
    0                     1    0.58     5.34
    1                     2    0.78     8.22
    2                     3    0.46    11.98
    3                     4    0.93    10.01
    4                     5    0.88     7.53
    5                     6    0.96     6.17
    6                     7    1.27     6.00
    7                     8    0.86     6.41
    8                     9    0.85     6.24
    9                    10    0.97     6.38
    10                   11    0.79     6.49
    11                   12   54.95     5.22
    12                   13    0.48     4.91
    13                   14    0.00     6.06
    14                   15    0.81     4.08
    15                   16    0.00     5.00
    16                   17    1.75     3.75
    17                   18    0.00     9.30
  107. # Set the chart dimensions
    plt.figure(figsize=(12, 6))
    
    # Compare monthly and annual churn rates across tenure months
    sns.lineplot(
        data=plan_tenure_churn,
        x="tenure_month",
        y="churn_rate_pct",
        hue="plan_type",
        marker="o"
    )
    
    # Add chart title and axis labels
    plt.title("Tenure-Adjusted Churn Rate by Subscription Type")
    plt.xlabel("Subscription Tenure (Months)")
    plt.ylabel("Churn Rate (%)")
    
    # Display the legend
    plt.legend(title="Subscription Type")
    
    # Improve chart spacing
    plt.tight_layout()
    
    # Display the chart
    plt.show()
    Chart produced by this cell
    <Figure size 1200x600 with 1 Axes>
  108. 14.2.1 Tenure-Adjusted Churn by Subscription Type – Findings

    The analysis compared monthly and annual subscriber churn rates across equivalent subscription tenure months.

    1. Early Subscription Period

    During tenure months 1–11, monthly subscribers consistently demonstrated higher churn percentages than annual subscribers.

    For example:

    • Month 1: Annual 0.58%, Monthly 5.34%.
    • Month 3: Annual 0.46%, Monthly 11.98%.
    • Month 6: Annual 0.96%, Monthly 6.17%.
    • Month 11: Annual 0.79%, Monthly 6.49%.

    2. Annual Subscription Month 12

    A significant difference was observed during tenure month 12:

    • Annual churn: 54.95%.
    • Monthly churn: 5.22%.

    Further investigation revealed that all 300 annual cancellations occurred before the expected first annual anniversary.

    The median cancellation occurred approximately 31 days before the anniversary.

    3. Key Business Observations

    • Monthly subscribers demonstrate higher churn during tenure months 1–11.
    • Annual subscribers experience a substantial cancellation spike during tenure month 12.
    • Annual cancellations are concentrated in the period leading up to the expected first anniversary.
    • Churn percentages during later tenure months should be interpreted cautiously because of smaller customer populations.

    Business Interpretation

    Subscription type remains strongly associated with different churn patterns after comparing customers at equivalent tenure stages.

    Monthly subscriptions present an early-retention challenge, while annual subscriptions demonstrate a potential pre-renewal retention challenge.

    Conclusion

    The analysis supports subscription type as an important candidate churn driver.

    Retention strategies should differ according to billing period and customer lifecycle stage.


  109. 14.3 Tenure-Adjusted Churn by Acquisition Channel

    In this section, we investigate whether acquisition channel remains associated with customer churn when subscription tenure is taken into account.

    Business Objectives

    • Calculate cancellations for each acquisition channel across tenure months.
    • Compare churn rates between acquisition channels at equivalent tenure stages.
    • Identify channels with consistently higher or lower churn.
    • Examine whether promotional customers demonstrate higher churn during similar subscription periods.

    Business Importance

    Different acquisition channels may attract customers with different engagement patterns and subscription behaviours.

    Comparing customers at similar tenure stages can help determine whether acquisition channel remains associated with churn after accounting for subscription duration.

    The findings can help the marketing team evaluate acquisition quality and improve customer retention strategies.

  110. # Group customers by tenure month and acquisition channel
    channel_tenure_churn = (
        customer_months
        .groupby(["tenure_month", "acquisition_channel"])
        .agg(
    
            # Count unique customers reaching each tenure month
            customers=("customer_id", "nunique"),
    
            # Count customers cancelling during that tenure month
            cancellations=("churned_this_month", "sum")
        )
        .reset_index()
    )
    
    # Calculate churn percentage for each channel and tenure month
    channel_tenure_churn["churn_rate_pct"] = (
        channel_tenure_churn["cancellations"]
        / channel_tenure_churn["customers"]
    ) * 100
    
    # Round the churn percentages
    channel_tenure_churn["churn_rate_pct"] = (
        channel_tenure_churn["churn_rate_pct"].round(2)
    )
    
    # Display the tenure-adjusted acquisition analysis
    channel_tenure_churn
        tenure_month acquisition_channel  customers  cancellations  churn_rate_pct
    0              1             organic       1298             53            4.08
    1              1         paid_social        989             30            3.03
    2              1             partner        476             21            4.41
    3              1         promo_offer        949             37            3.90
    4              1            referral        488             10            2.05
    ..           ...                 ...        ...            ...             ...
    85            18             organic         29              1            3.45
    86            18         paid_social         15              1            6.67
    87            18             partner          7              0            0.00
    88            18         promo_offer          7              0            0.00
    89            18            referral          9              2           22.22
    
    [90 rows x 5 columns]
  111. # Create a pivot table with separate columns for each acquisition channel
    channel_tenure_comparison = (
        channel_tenure_churn
        .pivot(
            index="tenure_month",
            columns="acquisition_channel",
            values="churn_rate_pct"
        )
        .reset_index()
    )
    
    # Display the comparison
    channel_tenure_comparison
    acquisition_channel  tenure_month  organic  paid_social  partner  promo_offer  \
    0                               1     4.08         3.03     4.41         3.90   
    1                               2     6.43         4.80     5.27         5.92   
    2                               3     5.06         5.04     4.87        16.32   
    3                               4     3.75         6.23     6.82        11.13   
    4                               5     4.69         4.80     5.25         3.85   
    5                               6     3.20         4.78     5.04         3.44   
    6                               7     3.80         4.56     3.83         2.07   
    7                               8     3.07         3.27     7.35         4.19   
    8                               9     4.20         3.79     4.76         1.52   
    9                              10     3.66         3.88     2.11         3.85   
    10                             11     3.42         5.49     4.00         1.67   
    11                             12    31.88        30.92    31.43        41.79   
    12                             13     2.09         4.10     6.78         3.09   
    13                             14     4.05         4.00     0.00         5.71   
    14                             15     1.75         1.39     6.06         4.17   
    15                             16     2.30         2.00     8.70         2.86   
    16                             17     5.45         0.00     0.00         0.00   
    17                             18     3.45         6.67     0.00         0.00   
    
    acquisition_channel  referral  
    0                        2.05  
    1                        3.14  
    2                        3.89  
    3                        3.59  
    4                        4.53  
    5                        2.82  
    6                        4.95  
    7                        2.40  
    8                        3.69  
    9                        3.78  
    10                       2.55  
    11                      24.81  
    12                       2.35  
    13          
  112. # Restrict the visualization to the first 12 tenure months
    # to avoid overemphasizing the smaller populations at longer tenures
    channel_plot_data = channel_tenure_churn[
        channel_tenure_churn["tenure_month"] <= 12
    ]
    
    # Set the chart dimensions
    plt.figure(figsize=(13, 6))
    
    # Compare churn rates across acquisition channels
    sns.lineplot(
        data=channel_plot_data,
        x="tenure_month",
        y="churn_rate_pct",
        hue="acquisition_channel",
        marker="o"
    )
    
    # Add chart title and axis labels
    plt.title("Tenure-Adjusted Churn by Acquisition Channel")
    plt.xlabel("Subscription Tenure (Months)")
    plt.ylabel("Churn Rate (%)")
    
    # Display the legend
    plt.legend(title="Acquisition Channel")
    
    # Adjust chart layout
    plt.tight_layout()
    
    # Display the chart
    plt.show()
    Chart produced by this cell
    <Figure size 1300x600 with 1 Axes>
  113. 14.3.1 Tenure-Adjusted Churn by Acquisition Channel – Findings

    The analysis compared customer churn across five acquisition channels at equivalent subscription tenure stages.

    1. Promotional Offer Channel

    Promotional customers demonstrated particularly high churn during:

    • Tenure Month 3: 16.32%.
    • Tenure Month 4: 11.13%.

    These rates were higher than those observed across the other acquisition channels during the same tenure months.

    However, promotional churn was not consistently the highest during later tenure months.

    2. Other Acquisition Channels

    Organic, Paid Social, Partner and Referral customers demonstrated varying churn patterns across subscription tenure.

    No single alternative channel consistently recorded the highest churn throughout the observed subscription lifecycle.

    3. Tenure Month 12

    All five acquisition channels experienced elevated churn during tenure month 12.

    Promo Offer recorded 41.79%, while the other channels ranged from 24.81% to 31.88%.

    This pattern may be associated with the annual subscription cancellation spike identified earlier.

    Business Interpretation

    Acquisition channel appears to have an association with customer churn during particular subscription stages.

    Promotional customers demonstrate elevated churn during tenure months 3 and 4.

    However, acquisition channel does not show a consistently higher churn pattern across every tenure month.

    Further investigation is required to separate acquisition-channel differences from subscription billing type.

    Conclusion

    Promotional acquisition is a potential churn factor that deserves further investigation, particularly during the third and fourth subscription months.

    A comparison controlling for both subscription type and tenure is required before drawing a stronger conclusion.


  114. 14.4 Churn Analysis by Acquisition Channel, Subscription Type and Tenure

    In this section, we investigate acquisition-channel churn while considering both subscription billing type and customer tenure.

    Business Objectives

    • Compare acquisition channels within monthly subscriptions.
    • Compare acquisition channels within annual subscriptions.
    • Calculate churn percentages across equivalent tenure stages.
    • Investigate whether promotional acquisition remains associated with higher churn after accounting for subscription type.

    Business Importance

    Acquisition channels may attract different proportions of monthly and annual subscribers.

    Since subscription type has a strong relationship with churn, comparing acquisition channels without accounting for billing type could produce misleading conclusions.

    This analysis provides a more detailed understanding of acquisition-channel retention patterns.

  115. # Group customers by tenure, subscription type and acquisition channel
    channel_plan_tenure = (
        customer_months
        .groupby(
            ["tenure_month", "plan_type", "acquisition_channel"]
        )
        .agg(
    
            # Count unique customers in each group
            customers=("customer_id", "nunique"),
    
            # Count cancellations during each tenure month
            cancellations=("churned_this_month", "sum")
        )
        .reset_index()
    )
    
    # Calculate churn percentage for each combination
    channel_plan_tenure["churn_rate_pct"] = (
        channel_plan_tenure["cancellations"]
        / channel_plan_tenure["customers"]
    ) * 100
    
    # Round percentages to two decimal places
    channel_plan_tenure["churn_rate_pct"] = (
        channel_plan_tenure["churn_rate_pct"].round(2)
    )
    
    # Display the results for the first 12 tenure months
    channel_plan_tenure[
        channel_plan_tenure["tenure_month"] <= 12
    ]
         tenure_month plan_type acquisition_channel  customers  cancellations  \
    0               1    annual             organic        478              6   
    1               1    annual         paid_social        348              1   
    2               1    annual             partner        170              2   
    3               1    annual         promo_offer        360              0   
    4               1    annual            referral        183              0   
    ..            ...       ...                 ...        ...            ...   
    115            12   monthly             organic        155             12   
    116            12   monthly         paid_social         97              5   
    117            12   monthly             partner         53              3   
    118            12   monthly         promo_offer         68              0   
    119            12   monthly            referral         68              3   
    
         churn_rate_pct  
    0              1.26  
    1              0.29  
    2              1.18  
    3              0.00  
    4              0.00  
    ..              ...  
    115            7.74  
    116            5.15  
    117            5.66  
    118            0.00  
    119            4.41  
    
    [120 rows x 6 columns]
  116. # Filter the analysis to monthly subscribers
    monthly_channel_comparison = channel_plan_tenure[
        (channel_plan_tenure["plan_type"] == "monthly")
        &
        (channel_plan_tenure["tenure_month"] <= 12)
    ]
    
    # Create a comparison table for monthly subscribers
    monthly_channel_pivot = (
        monthly_channel_comparison
        .pivot(
            index="tenure_month",
            columns="acquisition_channel",
            values="churn_rate_pct"
        )
        .reset_index()
    )
    
    # Display the monthly subscription comparison
    monthly_channel_pivot
    acquisition_channel  tenure_month  organic  paid_social  partner  promo_offer  \
    0                               1     5.73         4.52     6.21         6.28   
    1                               2     9.96         6.86     8.01         9.06   
    2                               3     8.33         7.72     7.58        27.49   
    3                               4     6.09         9.62    11.11        20.18   
    4                               5     7.22         7.86     8.51         7.23   
    5                               6     5.80         7.40     6.88         6.02   
    6                               7     6.58         6.64     4.41         3.72   
    7                               8     5.67         4.74    11.97         8.12   
    8                               9     6.92         5.53     8.70         3.73   
    9                              10     6.41         6.10     2.60         9.32   
    10                             11     6.22         9.30     7.69         3.33   
    11                             12     7.74         5.15     5.66         0.00   
    
    acquisition_channel  referral  
    0                        3.28  
    1                        5.08  
    2                        6.07  
    3                        5.58  
    4                        7.17  
    5                        4.37  
    6                        7.41  
    7                        4.32  
    8                        6.72  
    9                        6.19  
    10                       5.13  
    11                       4.41  
  117. # Filter the analysis to annual subscribers
    annual_channel_comparison = channel_plan_tenure[
        (channel_plan_tenure["plan_type"] == "annual")
        &
        (channel_plan_tenure["tenure_month"] <= 12)
    ]
    
    # Create a comparison table for annual subscribers
    annual_channel_pivot = (
        annual_channel_comparison
        .pivot(
            index="tenure_month",
            columns="acquisition_channel",
            values="churn_rate_pct"
        )
        .reset_index()
    )
    
    # Display the annual subscription comparison
    annual_channel_pivot
    acquisition_channel  tenure_month  organic  paid_social  partner  promo_offer  \
    0                               1     1.26         0.29     1.18         0.00   
    1                               2     0.64         1.15     0.60         1.11   
    2                               3     0.21         0.58     0.60         0.56   
    3                               4     0.46         0.97     0.64         1.83   
    4                               5     1.28         0.36     0.74         1.01   
    5                               6     0.00         1.21     2.54         1.44   
    6                               7     0.58         1.83     3.03         0.81   
    7                               8     0.32         1.53     1.15         1.35   
    8                               9     1.42         1.76     0.00         0.00   
    9                              10     1.16         1.38     1.54         0.00   
    10                             11     0.93         1.59     0.00         0.67   
    11                             12    51.58        53.64    57.69        63.16   
    
    acquisition_channel  referral  
    0                        0.00  
    1                        0.00  
    2                        0.55  
    3                        0.60  
    4                        0.66  
    5                        0.74  
    6                        1.65  
    7                        0.00  
    8                        0.00  
    9                        1.14  
    10                       0.00  
    11                      47.54  
  118. # Select monthly subscribers during tenure months 3 and 4
    # These are the periods with unusually high promotional churn
    
    monthly_promo_check = channel_plan_tenure[
        (channel_plan_tenure["plan_type"] == "monthly")
        &
        (channel_plan_tenure["tenure_month"].isin([3, 4]))
    ].copy()
    
    # Display customer counts and cancellations for each acquisition channel
    monthly_promo_check[
        [
            "tenure_month",
            "acquisition_channel",
            "customers",
            "cancellations",
            "churn_rate_pct"
        ]
    ].sort_values(
        ["tenure_month", "churn_rate_pct"],
        ascending=[True, False]
    )
        tenure_month acquisition_channel  customers  cancellations  churn_rate_pct
    28             3         promo_offer        502            138           27.49
    25             3             organic        696             58            8.33
    26             3         paid_social        570             44            7.72
    27             3             partner        264             20            7.58
    29             3            referral        280             17            6.07
    38             4         promo_offer        337             68           20.18
    37             4             partner        225             25           11.11
    36             4         paid_social        478             46            9.62
    35             4             organic        608             37            6.09
    39             4            referral        251             14            5.58
  119. # Select annual subscribers who reached tenure month 12
    annual_month12_check = channel_plan_tenure[
        (channel_plan_tenure["plan_type"] == "annual")
        &
        (channel_plan_tenure["tenure_month"] == 12)
    ].copy()
    
    # Display the customer counts behind each acquisition-channel rate
    annual_month12_check[
        [
            "acquisition_channel",
            "customers",
            "cancellations",
            "churn_rate_pct"
        ]
    ].sort_values(
        "churn_rate_pct",
        ascending=False
    )
        acquisition_channel  customers  cancellations  churn_rate_pct
    113         promo_offer        133             84           63.16
    112             partner         52             30           57.69
    111         paid_social        110             59           53.64
    110             organic        190             98           51.58
    114            referral         61             29           47.54
  120. 14.3.2 Acquisition Channel – Sample Size Validation

    We investigated the customer counts and cancellations behind the tenure-adjusted acquisition-channel churn percentages.

    1. Monthly Subscribers – Tenure Month 3

    • Promo Offer: 502 customers, 138 cancellations, 27.49% churn.
    • Organic: 696 customers, 58 cancellations, 8.33% churn.
    • Paid Social: 570 customers, 44 cancellations, 7.72% churn.
    • Partner: 264 customers, 20 cancellations, 7.58% churn.
    • Referral: 280 customers, 17 cancellations, 6.07% churn.

    2. Monthly Subscribers – Tenure Month 4

    • Promo Offer: 337 customers, 68 cancellations, 20.18% churn.
    • Organic: 608 customers, 37 cancellations, 6.09% churn.
    • Paid Social: 478 customers, 46 cancellations, 9.62% churn.
    • Partner: 225 customers, 25 cancellations, 11.11% churn.
    • Referral: 251 customers, 14 cancellations, 5.58% churn.

    3. Annual Subscribers – Tenure Month 12

    • Promo Offer: 133 customers, 84 cancellations, 63.16% churn.
    • Partner: 52 customers, 30 cancellations, 57.69% churn.
    • Paid Social: 110 customers, 59 cancellations, 53.64% churn.
    • Organic: 190 customers, 98 cancellations, 51.58% churn.
    • Referral: 61 customers, 29 cancellations, 47.54% churn.

    Key Observations

    • Promotional acquisition demonstrates substantially higher churn among monthly subscribers during tenure months 3 and 4.
    • This pattern is supported by meaningful customer counts in both months.
    • Annual subscribers across all acquisition channels experience elevated churn during tenure month 12.
    • Promotional acquisition has the highest observed churn among annual subscribers during tenure month 12.

    Business Interpretation

    Promotional acquisition may attract customers who are less likely to remain subscribed, particularly during the early months of monthly subscriptions.

    The annual subscription results also highlight a separate pre-renewal retention opportunity.

    Conclusion

    Acquisition channel remains an important candidate factor associated with churn after comparing customers within the same subscription type and tenure month.

    Further analysis is required to establish the underlying reasons for these differences.


  121. 14.5 Tenure-Adjusted Customer Engagement Analysis

    In this section, we investigate whether differences in customer workout engagement remain when subscribers are compared at equivalent subscription tenure stages.

    Business Objectives

    • Compare workouts completed across customer tenure months.
    • Investigate engagement differences between customers who cancel and those who continue.
    • Examine whether lower workout activity is associated with cancellation during the following month.
    • Identify subscription stages where declining engagement may indicate potential churn risk.

    Business Importance

    Customers who remain subscribed for longer periods have more opportunities to accumulate workouts.

    Comparing total workouts across customers with different subscription durations can therefore produce misleading results.

    Comparing engagement at equivalent tenure stages provides a fairer understanding of customer behaviour.

    Analysis Approach

    We will examine workout activity during one tenure month and relate it to whether the customer cancels during the following tenure month.

    This approach helps avoid using activity recorded during the same month as cancellation to predict that cancellation.

    The analysis will account for the completeness of usage records and the limitations of monthly aggregated activity data.

  122. # Select the customer and subscription information needed for analysis
    customer_attributes = subscriptions[
        [
            "customer_id",
            "churned",
            "plan_type",
            "plan_tier",
            "acquisition_channel",
            "primary_device",
            "age_group"
        ]
    ].copy()
    
    # Extract the customer, month and workout metrics
    engagement_monthly = usage[
        [
            "customer_id",
            "month",
            "workouts_completed",
            "minutes_active",
            "classes_booked",
            "support_tickets"
        ]
    ].copy()
    
    # Convert usage dates into monthly periods
    engagement_monthly["month_period"] = (
        engagement_monthly["month"].dt.to_period("M")
    )
    
    # Attach customer subscription information to monthly usage records
    engagement_monthly = engagement_monthly.merge(
        customer_attributes,
        on="customer_id",
        how="left",
        validate="many_to_one"
    )
    
    # Attach the customer's tenure month from our validated customer-month dataset
    engagement_monthly = engagement_monthly.merge(
        customer_months[
            [
                "customer_id",
                "month",
                "tenure_month",
                "churned_this_month"
            ]
        ],
        left_on=["customer_id", "month_period"],
        right_on=["customer_id", "month"],
        how="left",
        validate="one_to_one"
    )
    
    # Check the resulting dataset
    print("Engagement records:", engagement_monthly.shape)
    
    # Display the first five records
    engagement_monthly.head()
    Engagement records: (30525, 16)
    
       customer_id    month_x  workouts_completed  minutes_active  classes_booked  \
    0            1 2024-09-01                   5           140.0               0   
    1            1 2024-10-01                   4           116.0               0   
    2            1 2024-11-01                   7           208.0               0   
    3            1 2024-12-01                   5           109.0               0   
    4            1 2025-01-01                   1            41.0               0   
    
       support_tickets month_period churned plan_type plan_tier  \
    0                0      2024-09     yes   monthly     basic   
    1                0      2024-10     yes   monthly     basic   
    2                0      2024-11     yes   monthly     basic   
    3                0      2024-12     yes   monthly     basic   
    4                0      2025-01     yes   monthly     basic   
    
      acquisition_channel primary_device age_group  month_y  tenure_month  \
    0         promo_offer        android     45-54  2024-09             1   
    1         promo_offer        android     45-54  2024-10             2   
    2         promo_offer        android     45-54  2024-11             3   
    3         promo_offer        android     45-54  2024-12             4   
    4         promo_offer        android     45-54  2025-01             5   
    
       churned_this_month  
    0               False  
    1               False  
    2               False  
    3               False  
    4               False  
  123. # Sort customers by tenure so that their monthly records are in chronological order
    engagement_monthly = engagement_monthly.sort_values(
        ["customer_id", "tenure_month"]
    ).copy()
    
    # Identify whether each customer cancels during the following tenure month
    engagement_monthly["churn_next_month"] = (
        engagement_monthly
        .groupby("customer_id")["churned_this_month"]
        .shift(-1)
    )
    
    # Display the customer, tenure and next-month churn information
    engagement_monthly[
        [
            "customer_id",
            "tenure_month",
            "workouts_completed",
            "churned_this_month",
            "churn_next_month"
        ]
    ].head(15)
        customer_id  tenure_month  workouts_completed  churned_this_month  \
    0             1             1                   5               False   
    1             1             2                   4               False   
    2             1             3                   7               False   
    3             1             4                   5               False   
    4             1             5                   1               False   
    5             1             6                   6               False   
    6             1             7                   5               False   
    7             1             8                   3               False   
    8             1             9                   7               False   
    9             1            10                   3                True   
    10            2             1                   2               False   
    11            2             2                   0               False   
    12            2             3                   1               False   
    13            2             4                   1               False   
    14            2             5                   0               False   
    
       churn_next_month  
    0             False  
    1             False  
    2             False  
    3             False  
    4             False  
    5             False  
    6             False  
    7             False  
    8              True  
    9               NaN  
    10            False  
    11            False  
    12            False  
    13            False  
    14              NaN  
  124. 14.5.1 Preparing Next-Month Churn Indicators

    To investigate whether customer engagement is associated with future cancellations, we created a new variable called churn_next_month.

    Approach

    • Customer records were sorted by customer ID and subscription tenure.
    • The shift(-1) function was used to identify the customer's cancellation status during the following tenure month.
    • Each customer's current-month engagement can now be compared with their following-month cancellation outcome.

    Interpretation

    • True: The customer cancelled during the following tenure month.
    • False: The customer did not cancel during the following tenure month.
    • NaN: No subsequent observed usage month is available.

    Business Importance

    This approach allows us to investigate whether reduced workout engagement precedes customer cancellations.

    It helps distinguish engagement behaviour that occurs before cancellation from activity recorded during the cancellation month itself.

    Data Limitation

    Customers without a subsequent observed usage month cannot be included in the next-month outcome comparison.

    This includes customers at the end of the observation period, customers whose recorded usage ends because of cancellation, and customers with incomplete usage histories.

    Conclusion

    The next-month cancellation indicator has been created successfully and will be used to examine the relationship between customer engagement and future churn.

  125. # Identify the next observed tenure month for each customer
    engagement_monthly["next_tenure_month"] = (
        engagement_monthly
        .groupby("customer_id")["tenure_month"]
        .shift(-1)
    )
    
    # Select records where the next-month churn outcome is available
    valid_next_month = engagement_monthly[
        engagement_monthly["churn_next_month"].notna()
    ].copy()
    
    # Check whether every next-month record is exactly one tenure month ahead
    consecutive_month_check = (
        valid_next_month["next_tenure_month"]
        - valid_next_month["tenure_month"]
    )
    
    # Display the validation results
    print("Records with known next-month outcomes:",
          len(valid_next_month))
    
    print("Non-consecutive tenure records:",
          (consecutive_month_check != 1).sum())
    
    # Count customers who cancelled during the following month
    print(
        "Cancelled next month:",
        (valid_next_month["churn_next_month"] == True).sum()
    )
    
    # Count customers who remained subscribed during the following month
    print(
        "Did not cancel next month:",
        (valid_next_month["churn_next_month"] == False).sum()
    )
    Records with known next-month outcomes: 26325
    Non-consecutive tenure records: 0
    Cancelled next month: 1617
    Did not cancel next month: 24708
    
  126. 14.5.1 Validation of Next-Month Cancellation Outcomes

    Before analyzing the relationship between workout engagement and future churn, we validated the next-month cancellation indicator.

    Validation Results

    • Records with known next-month outcomes: 26,325.
    • Customers who cancelled during the following month: 1,617.
    • Customers who did not cancel during the following month: 24,708.
    • Non-consecutive tenure records: 0.

    Key Observations

    • All available next-month outcomes correspond to consecutive subscription tenure months.
    • The 1,617 cancellations match the number of customers who cancelled after their signup month.
    • Customers without a subsequent observed usage month were excluded from the next-month comparison.

    Conclusion

    The next-month cancellation indicator passed the validation checks and is suitable for the upcoming engagement analysis.

    We will compare workout activity across equivalent tenure stages to investigate whether lower engagement is associated with subsequent cancellation.


  127. 14.6 Workout Frequency and Next-Month Customer Churn

    In this section, we investigate whether workout frequency is associated with customer cancellations during the following subscription month.

    Business Objectives

    • Categorize customers according to monthly workout frequency.
    • Calculate the number of customers in each workout category.
    • Identify cancellations occurring during the following month.
    • Calculate next-month cancellation percentages for each workout category.
    • Compare workout engagement across equivalent subscription tenure stages.

    Workout Categories

    • Zero workouts: 0 completed workouts.
    • Low engagement: 1–2 completed workouts.
    • Moderate engagement: 3–5 completed workouts.
    • High engagement: 6 or more completed workouts.

    Business Importance

    Customers who participate less frequently may have weaker engagement with the fitness platform.

    Identifying differences in subsequent cancellation rates across workout categories can help the membership team recognize potential retention risks.

    Analysis Approach

    We will compare current-month workout frequency with cancellation outcomes during the immediately following tenure month.

    The analysis will account for subscription tenure to avoid misleading comparisons between customers at different subscription stages.

  128. # Keep only customer-month records with a known next-month outcome
    valid_next_month = engagement_monthly[
        engagement_monthly["churn_next_month"].notna()
    ].copy()
    
    # Convert the next-month outcome into boolean values
    valid_next_month["churn_next_month"] = (
        valid_next_month["churn_next_month"].astype(bool)
    )
    
    # Divide customers into workout-frequency categories
    valid_next_month["workout_category"] = pd.cut(
        valid_next_month["workouts_completed"],
    
        # Define the boundaries for workout categories
        bins=[-1, 0, 2, 5, np.inf],
    
        # Assign category names
        labels=["Zero", "Low", "Moderate", "High"]
    )
    
    # Display the first 10 categorized records
    valid_next_month[
        [
            "customer_id",
            "tenure_month",
            "workouts_completed",
            "workout_category",
            "churn_next_month"
        ]
    ].head(10)
        customer_id  tenure_month  workouts_completed workout_category  \
    0             1             1                   5         Moderate   
    1             1             2                   4         Moderate   
    2             1             3                   7             High   
    3             1             4                   5         Moderate   
    4             1             5                   1              Low   
    5             1             6                   6             High   
    6             1             7                   5         Moderate   
    7             1             8                   3         Moderate   
    8             1             9                   7             High   
    10            2             1                   2              Low   
    
        churn_next_month  
    0              False  
    1              False  
    2              False  
    3              False  
    4              False  
    5              False  
    6              False  
    7              False  
    8               True  
    10             False  
  129. # Group customers by subscription tenure and workout category
    workout_churn_analysis = (
        valid_next_month
        .groupby(
            ["tenure_month", "workout_category"],
            observed=True
        )
        .agg(
    
            # Count customers with a known next-month outcome
            customers=("customer_id", "nunique"),
    
            # Count customers who cancelled during the following month
            cancellations_next_month=("churn_next_month", "sum")
        )
        .reset_index()
    )
    
    # Calculate the next-month cancellation percentage
    workout_churn_analysis["next_month_churn_pct"] = (
        workout_churn_analysis["cancellations_next_month"]
        / workout_churn_analysis["customers"]
    ) * 100
    
    # Round percentages to two decimal places
    workout_churn_analysis["next_month_churn_pct"] = (
        workout_churn_analysis["next_month_churn_pct"].round(2)
    )
    
    # Display the tenure-adjusted workout analysis
    workout_churn_analysis
        tenure_month workout_category  customers  cancellations_next_month  \
    0              1             Zero        321                        31   
    1              1              Low       1240                        93   
    2              1         Moderate       1326                        73   
    3              1             High       1023                        22   
    4              2             Zero        274                        39   
    ..           ...              ...        ...                       ...   
    63            16             High         43                         2   
    64            17             Zero          4                         1   
    65            17              Low         10                         0   
    66            17         Moderate         22                         1   
    67            17             High         27                         2   
    
        next_month_churn_pct  
    0                   9.66  
    1                   7.50  
    2                   5.51  
    3                   2.15  
    4                  14.23  
    ..                   ...  
    63                  4.65  
    64                 25.00  
    65                  0.00  
    66                  4.55  
    67                  7.41  
    
    [68 rows x 5 columns]
  130. # Create a pivot table to compare workout categories
    # across different subscription tenure months
    
    workout_churn_pivot = (
        workout_churn_analysis
        .pivot(
            index="tenure_month",
            columns="workout_category",
            values="next_month_churn_pct"
        )
        .reset_index()
    )
    
    # Display the comparison
    workout_churn_pivot
    workout_category  tenure_month   Zero    Low  Moderate   High
    0                            1   9.66   7.50      5.51   2.15
    1                            2  14.23  12.45      6.55   3.62
    2                            3  10.37   8.78      6.95   3.04
    3                            4   7.51   6.96      5.28   1.99
    4                            5   6.90   4.79      3.99   2.27
    5                            6   4.57   6.28      3.08   2.65
    6                            7   6.63   6.27      2.73   1.87
    7                            8   3.37   5.33      3.86   2.32
    8                            9   7.88   6.38      1.62   1.86
    9                           10   5.59   5.28      2.81   2.13
    10                          11  67.13  51.34     20.87  15.10
    11                          12   7.84   5.94      3.27   1.49
    12                          13  14.71   4.00      0.72   4.96
    13                          14   3.57   5.80      2.53   1.72
    14                          15   4.76   2.63      5.56   2.04
    15                          16   0.00   4.76      2.04   4.65
    16                          17  25.00   0.00      4.55   7.41
  131. # Restrict the chart to the first 12 tenure months
    # to avoid overemphasizing small populations at longer tenures
    
    workout_plot_data = workout_churn_analysis[
        workout_churn_analysis["tenure_month"] <= 12
    ]
    
    # Set the chart dimensions
    plt.figure(figsize=(12, 6))
    
    # Compare next-month cancellation percentages across workout categories
    sns.lineplot(
        data=workout_plot_data,
        x="tenure_month",
        y="next_month_churn_pct",
        hue="workout_category",
        marker="o"
    )
    
    # Add chart title and axis labels
    plt.title("Next-Month Churn by Workout Frequency and Tenure")
    plt.xlabel("Subscription Tenure (Months)")
    plt.ylabel("Next-Month Cancellation (%)")
    
    # Display the legend
    plt.legend(title="Workout Category")
    
    # Adjust chart spacing
    plt.tight_layout()
    
    # Display the chart
    plt.show()
    Chart produced by this cell
    <Figure size 1200x600 with 1 Axes>
  132. 14.6.1 Workout Frequency and Next-Month Churn – Key Findings

    The analysis examined whether customers with different workout frequencies were more likely to cancel during their following subscription month.

    Workout Categories

    • Zero: 0 workouts.
    • Low: 1–2 workouts.
    • Moderate: 3–5 workouts.
    • High: 6 or more workouts.

    1. Early Subscription Period

    During several early subscription months, customers completing fewer workouts demonstrated higher next-month cancellation percentages.

    For example, during tenure month 2:

    • Zero workouts: 14.23%.
    • Low engagement: 12.45%.
    • Moderate engagement: 6.55%.
    • High engagement: 3.62%.

    2. Tenure Month 11

    An unusually high next-month cancellation percentage was observed during tenure month 11:

    • Zero workouts: 67.13%.
    • Low engagement: 51.34%.
    • Moderate engagement: 20.87%.
    • High engagement: 15.10%.

    The following month corresponds to tenure month 12, where we previously identified substantial annual subscription cancellations.

    Key Observations

    • Lower workout frequency is generally associated with higher next-month cancellation during several tenure periods.
    • The relationship is not perfectly consistent across every month.
    • A significant cancellation spike occurs during the transition from tenure month 11 to month 12.
    • Subscription billing type may influence the observed relationship.

    Business Interpretation

    Workout engagement appears to be associated with subsequent customer retention.

    Customers who complete fewer workouts may be less engaged with the platform and could benefit from early engagement interventions.

    However, the annual subscription cancellation pattern may influence some of the observed results.

    Conclusion

    Lower workout engagement is a promising candidate churn indicator.

    Further analysis controlling for subscription type and tenure is required before determining its independent association with customer cancellation.


  133. 14.7 Workout Engagement by Subscription Type and Tenure

    In this section, we investigate workout frequency and next-month cancellation separately for monthly and annual subscribers.

    Business Objectives

    • Compare workout engagement among monthly subscribers.
    • Compare workout engagement among annual subscribers.
    • Calculate next-month cancellation percentages by workout category and tenure.
    • Identify whether the relationship between workout frequency and cancellation remains within each billing type.

    Business Importance

    Monthly and annual subscribers demonstrate substantially different cancellation patterns.

    Separating these groups will help determine whether workout engagement is associated with future cancellations independently of subscription billing type.

    This will provide a more reliable basis for identifying customer engagement as a potential churn driver.

  134. # Group customer-month records by tenure, subscription type and workout category
    workout_plan_tenure = (
        valid_next_month
        .groupby(
            ["tenure_month", "plan_type", "workout_category"],
            observed=True
        )
        .agg(
            # Count unique customers in each group
            customers=("customer_id", "nunique"),
    
            # Count cancellations during the following month
            cancellations_next_month=("churn_next_month", "sum")
        )
        .reset_index()
    )
    
    # Calculate next-month churn percentage for each group
    workout_plan_tenure["next_month_churn_pct"] = (
        workout_plan_tenure["cancellations_next_month"]
        / workout_plan_tenure["customers"]
    ) * 100
    
    # Round the percentages
    workout_plan_tenure["next_month_churn_pct"] = (
        workout_plan_tenure["next_month_churn_pct"].round(2)
    )
    
    # Display the results for the first 12 tenure months
    workout_plan_tenure[
        workout_plan_tenure["tenure_month"] <= 12
    ]
        tenure_month plan_type workout_category  customers  \
    0              1    annual             Zero        136   
    1              1    annual              Low        510   
    2              1    annual         Moderate        501   
    3              1    annual             High        377   
    4              1   monthly             Zero        185   
    ..           ...       ...              ...        ...   
    91            12    annual             High         71   
    92            12   monthly             Zero         32   
    93            12   monthly              Low         54   
    94            12   monthly         Moderate         84   
    95            12   monthly             High        130   
    
        cancellations_next_month  next_month_churn_pct  
    0                          0                  0.00  
    1                          8                  1.57  
    2                          4                  0.80  
    3                          0                  0.00  
    4                         31                 16.76  
    ..                       ...                   ...  
    91                         0                  0.00  
    92                         4                 12.50  
    93                         5                  9.26  
    94                         5                  5.95  
    95                         3                  2.31  
    
    [96 rows x 6 columns]
  135. # Filter the results to monthly subscribers
    monthly_workout_churn = workout_plan_tenure[
        (workout_plan_tenure["plan_type"] == "monthly")
        &
        (workout_plan_tenure["tenure_month"] <= 12)
    ]
    
    # Create a comparison table for monthly subscribers
    monthly_workout_pivot = (
        monthly_workout_churn
        .pivot(
            index="tenure_month",
            columns="workout_category",
            values="next_month_churn_pct"
        )
        .reset_index()
    )
    
    # Display monthly subscriber results
    monthly_workout_pivot
    workout_category  tenure_month   Zero    Low  Moderate  High
    0                            1  16.76  11.64      8.36  3.41
    1                            2  27.34  21.09     10.94  5.73
    2                            3  20.91  15.13     11.58  4.85
    3                            4  15.73  13.27      9.20  3.01
    4                            5  18.07   9.03      6.12  3.66
    5                            6  12.86  11.54      4.64  3.86
    6                            7  16.92  12.39      5.34  3.13
    7                            8   8.06  12.28      6.07  4.01
    8                            9  18.75  15.79      3.12  3.23
    9                           10  15.79  14.15      5.19  3.69
    10                          11  14.29  11.39      2.86  3.95
    11                          12  12.50   9.26      5.95  2.31
  136. # Filter the results to annual subscribers
    annual_workout_churn = workout_plan_tenure[
        (workout_plan_tenure["plan_type"] == "annual")
        &
        (workout_plan_tenure["tenure_month"] <= 12)
    ]
    
    # Create a comparison table for annual subscribers
    annual_workout_pivot = (
        annual_workout_churn
        .pivot(
            index="tenure_month",
            columns="workout_category",
            values="next_month_churn_pct"
        )
        .reset_index()
    )
    
    # Display annual subscriber results
    annual_workout_pivot
    workout_category  tenure_month   Zero    Low  Moderate   High
    0                            1   0.00   1.57      0.80   0.00
    1                            2   2.74   0.50      0.00   0.22
    2                            3   1.53   1.29      1.08   0.25
    3                            4   1.61   1.78      0.26   0.29
    4                            5   0.67   1.36      1.49   0.00
    5                            6   0.67   1.92      1.36   0.76
    6                            7   1.53   1.95      0.00   0.00
    7                            8   0.86   1.08      1.37   0.00
    8                            9   3.42   1.23      0.00   0.00
    9                           10   2.44   0.51      0.67   0.00
    10                          11  80.00  68.68     36.00  31.40
    11                          12   0.00   2.13      0.00   0.00

The brief this answers

Find out why subscribers of a fitness app cancel, and give leadership an evidence-backed plan to keep them.

Try it yourself

Other answers to this brief

The same problem, solved by somebody else.

Discussion

Nothing here yet. Ask how they approached it, or tell them what you would have done differently.