Analyzing Customer Churn in a Subscription Service


New member
You work for a subscription-based streaming service, and you're tasked with analyzing customer churn to identify patterns and factors contributing to customers canceling their subscriptions. Your dataset contains customer information, subscription details, and churn status. Here is a sample dataset:

import pandas as pd

customer_data = pd.DataFrame({
    'customer_id': [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
    'subscription_start_date': ['2023-01-01', '2023-01-02', '2023-01-03', '2023-01-04', '2023-01-05', '2023-01-06', '2023-01-07', '2023-01-08', '2023-01-09', '2023-01-10'],
    'subscription_end_date': ['2023-02-01', '2023-02-02', '2023-02-03', '2023-02-04', '2023-02-05', '2023-02-06', '2023-02-07', '2023-02-08', '2023-02-09', '2023-02-10'],
    'churned': [True, False, True, False, False, True, False, False, True, False],
    'subscription_plan': ['Basic', 'Premium', 'Basic', 'Premium', 'Premium', 'Basic', 'Basic', 'Premium', 'Basic', 'Premium'],
    'age': [28, 35, 42, 22, 50, 31, 45, 29, 38, 27]

Here are the tasks you I need to accomplish:

  1. Calculate the overall churn rate for the streaming service during this period.
  2. Explore the relationship between subscription plans and churn. Are certain plans more prone to churn than others?
  3. Analyze the average age of customers who churned and those who didn't. Is there a significant age difference between the two groups?
  4. Create a visualization (e.g., a line chart or bar chart) to illustrate the trend in churn rates over time.

I looked at several websites in an effort to locate the answer, but I was unable. To complete each of these jobs and deliver details on user churn for the streaming service, kindly submit Python code. Thank you.