Skip to content
Project: Analyzing 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 four datasets to investigate:
brands.csv
| Columns | Description |
|---|---|
product_id | Unique product identifier |
brand | Brand of the product |
finance.csv
| Columns | Description |
|---|---|
product_id | Unique product identifier |
listing_price | Original price of the product |
sale_price | Discounted price of the product |
discount | Discount off the listing price, as a decimal |
revenue | Revenue generated by the product |
info.csv
| Columns | Description |
|---|---|
product_name | Name of the product |
product_id | Unique product identifier |
description | Description of the product |
reviews.csv
| Columns | Description |
|---|---|
product_id | Unique product identifier |
rating | Average product rating |
reviews | Number of reviews for the product |
1 - Reading in and formatting the data
# Storing the files as pandas DataFrames
import pandas as pd
brands = pd.read_csv('brands.csv')
finance = pd.read_csv('finance.csv')
info = pd.read_csv('info.csv')
reviews = pd.read_csv('reviews.csv')
# Start coding here...# Formatting the datasets for analysis
merged_df = brands.merge(finance, on='product_id')
merged_df = merged_df.merge(info, on='product_id')
merged_df = merged_df.merge(reviews, on='product_id')
merged_df.info()merged_df.head()# Dropping null values
merged_df = merged_df.dropna()
merged_df.info()merged_df.isna().sum()2 - Sales performance of Adidas and Nike products
# Creating a column in the DataFrame called price_label
labels = ['Budget', 'Average', 'Expensive', 'Elite']
merged_df['price_label'] = pd.qcut(x=merged_df['listing_price'], q=4, labels=labels)merged_df[['listing_price', 'price_label']].sample(5)# Calculating metrics based on price_label
adidas_vs_nike = merged_df.groupby(['brand', 'price_label'], as_index=False).agg(num_products=('product_id', 'count'), mean_revenue=('revenue', 'mean')).round(2)
adidas_vs_nike3 - Finding the relationship between product description lengths, ratings, and reviews
# Finding the length of each product description
merged_df['description_length'] = merged_df['description'].str.len()
merged_df.head()merged_df.describe()# Creating bins for word limits and labels for description lengths
bins = [0, 100, 200, 300, 400, 500, 600, 700]
labels = ['100', '200', '300', '400', '500', '600', '700']