Skip to content
Optimizing Online Sports Revenue
Sports clothing and athleisure attire is a huge industry, worth approximately $193 billion in 2021 with a strong growth forecast over the next decade!
In this notebook, you will undertake the role of a product analyst for an online sports clothing company. The company is specifically interested in how it can improve revenue. You will dive into product data such as pricing, reviews, descriptions, and ratings, as well as revenue and website traffic, to produce recommendations for its marketing and sales teams.
You've been provided with five datasets to investigate:
info.csv
finance.csv
reviews.csv
traffic.csv
brands.csv
The company has asked you to answer the following questions:
What is the volume of products and average revenue for Adidas and Nike products based on price quartiles?
- Label products priced up to quartile one as
"Budget"
, quartile 2 as"Average"
, quartile 3 as"Expensive"
, and quartile 4 as"Elite"
. - Store as a
pandas
DataFrame calledadidas_vs_nike
containing the following columns:"brand"
,"price_label"
,"count"
, and"revenue"
.
Do any differences exist between the word count of a product's description and its mean rating?
- Store the results as a
pandas
DataFrame calleddescription_lengths
containing the following columns:"description_length"
,"rating"
,"reviews"
.
How does the volume of products and median revenue vary between clothing and footwear?
- Store as a
pandas
DataFrame calledproduct_types
containing the following columns:"clothing_products"
,"clothing_revenue"
,"footwear_products"
,"footwear_revenue"
.
Completing the project
- Create a dictionary called
revenue_analysis
containing the following key-value pairs:"brand_analysis"
:adidas_vs_nike
DataFrame."description_analysis"
:description_lengths
DataFrame."product_analysis"
:product_types
DataFrame
# Start coding here...
import pandas as pd
info = pd.read_csv('info.csv')
finance = pd.read_csv('finance.csv')
reviews = pd.read_csv('reviews.csv')
traffic = pd.read_csv('traffic.csv')
brands = pd.read_csv('brands.csv')
data = pd.merge(info, finance, on='product_id', how='outer')
data = pd.merge(data, reviews, on='product_id', how='outer')
data = pd.merge(data, traffic, on='product_id', how='outer')
data = pd.merge(data, brands, on='product_id', how='outer')
# drop null values
data = data.dropna()
# print the merged data frame
display(data)
label = ["Budget", "Average", "Expensive", "Elite"]
data['price_label'] = pd.qcut(data['listing_price'], [0, .25, .5, .75, 1.], labels=label)
adidas_vs_nike = data.groupby(['brand', 'price_label']).agg({'price_label':'count', 'revenue':'mean'})
adidas_vs_nike
limits = [0, 99, 199, 299, 399, 499, 599, 699]
labels = ["99", "199", "299", "399", "499", "599", "699"]
data['word_limit'] = data['description'].str.len()
data['description_length'] = pd.cut(data['word_limit'], limits, labels=labels)
description_lengths = data.groupby('description_length').agg({'rating':'mean', 'reviews':'count'})
description_lengths
footwear = data["description"].str.contains("plimsole*|basketball trainers")
clothing = data.isin(~footwear)
footwear = pd.DataFrame(footwear, columns={"footwear_products":footwear.product_name, "footwear_revenue":footwear.revenue}, index=[0])
footwear.len()
footwear['revenue'].median()
clothing = pd.DataFrame(clothing, columns={"clothing_products":clothing.product_name, "clothing_revenue":clothing.revenue}, index=[0])
clothing.len()
clothing['revenue'].median()
product_types
Run cancelled
# Share your results in this format
revenue_analysis = {"brand_analysis": adidas_vs_nike,
"description_analysis": description_lengths,
"product_analysis": product_types}
# Call the answer!
revenue_analysis