Skip to content

A SaaS company seeks to uncover what drives its clients to renew subscriptions. They’ve collected data on client details, subscription records, and economic indicators and would like to connect them to better understand its clients’ behavior.

They’ve tasked you with analyzing these datasets to identify the key factors influencing clients’ decisions to renew their subscriptions.

Your analysis will provide them with insights into which customers are renewing their products and the reasons behind their renewals. The company can leverage these insights to make informed decisions to increase renewal rates and improve customer loyalty, helping them stay competitive and ensure long-term growth.

The Data

The company have provided you with three datasets for your analysis. A summary of each data is provided below.

client_details.csv

ColumnDescription
client_idUnique identifier for each client.
company_sizeSize of the company (Small, Medium, Large).
industryIndustry to which the client belongs (Fintech, Gaming, Crypto, AI, E-commerce).
locationLocation of the client (New York, New Jersey, Pennsylvania, Massachusetts, Connecticut).

subscription_records.csv

ColumnDescription
client_idUnique identifier for each client.
subscription_typeType of subscription (Yearly, Monthly).
start_dateStart date of the subscription - YYYY-MM-DD.
end_dateEnd date of the subscription - YYYY-MM-DD.
renewedIndicates whether the subscription was renewed (True, False).

economic_indicators.csv

ColumnDescription
start_dateStart date of the economic indicator (Quarterly) - YYYY-MM-DD.
end_dateEnd date of the economic indicator (Quarterly) - YYYY-MM-DD.
inflation_rateInflation rate in the period.
gdp_growth_rateGross Domestic Product (GDP) growth rate in the period.
# Re-run this cell
# Import required libraries
import pandas as pd

# Import data
client_details = pd.read_csv('data/client_details.csv')
subscription_records = pd.read_csv('data/subscription_records.csv', parse_dates = ['start_date', 'end_date'])
economic_indicators = pd.read_csv('data/economic_indicators.csv', parse_dates = ['start_date', 'end_date'])
print(client_details.info())
print(subscription_records.info())
print(economic_indicators.info())
# Drop first Unnamed column in economic_indicators DataFrame
economic_indicators = economic_indicators.drop(economic_indicators.columns[0], axis=1)
print(client_details.head())
print(subscription_records.head())
print(economic_indicators.head())
# Start coding here, good luck!

1 - Count the number of Fintech and Crypto clients

# Define a function to mark which clients are in the Fintech or Crypto industries
def in_fintech_or_crypto(industry):
    if industry in ['Fintech', 'Crypto']:
        return 1
    else:
        return 0
print(in_fintech_or_crypto('Fintech'))
print(in_fintech_or_crypto('Crypto'))
print(in_fintech_or_crypto('Gaming'))
# Count the number of Fintech and Crypto clients
total_fintech_crypto_clients = client_details['industry'].apply(in_fintech_or_crypto).sum()
print(total_fintech_crypto_clients)

2 - Find the industry with the highest renewal rate

# Merge the client and subscription data
client_subscription = client_details.merge(subscription_records, on='client_id', how='right')
client_subscription.head()
client_subscription.info()
# Find the average renewal rate by industry
avg_renewal_rate = client_subscription.groupby('industry').agg({'renewed': 'mean'})
avg_renewal_rate
type(avg_renewal_rate)