Skip to content

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

ColumnsDescription
product_idUnique product identifier
brandBrand of the product

finance.csv

ColumnsDescription
product_idUnique product identifier
listing_priceOriginal price of the product
sale_priceDiscounted price of the product
discountDiscount off the listing price, as a decimal
revenueRevenue generated by the product

info.csv

ColumnsDescription
product_nameName of the product
product_idUnique product identifier
descriptionDescription of the product

reviews.csv

ColumnsDescription
product_idUnique product identifier
ratingAverage product rating
reviewsNumber of reviews for the product
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")
#traffic = pd.read_csv("traffic.csv")

# Start coding here...
merged_df = info.merge(finance, on="product_id", how="outer")
merged_df = merged_df.merge(reviews, on="product_id", how="outer")
merged_df = merged_df.merge(brands, on="product_id", how="outer")
merged_df.head()
merged_df.dropna(inplace=True)
merged_df.isnull().sum()
#price_label = "price_category"  # Define the price_label variable
merged_df["price_label"] = pd.qcut(merged_df["listing_price"], q=4, labels=["Budget", "Average", "Expensive", "Elite"])
merged_df
adidas_vs_nike = merged_df.groupby(["brand","price_label"], as_index=False).agg(num_products=("product_id","count"), mean_revenue=("revenue", "mean")).round(2).reset_index(drop=True)
adidas_vs_nike.head()
merged_df["description_length"] = merged_df["description"].str.len()
merged_df.head()
merged_df["description_length"].max()
lengthes = [0, 100, 200, 300, 400, 500, 600, 700]
labels = ["100", "200", "300", "400", "500", "600", "700"]