Project: Analyzing Online Sports Revenue
  • AI Chat
  • Code
  • Report
  • Beta
    Spinner

    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

    1. Reading in and formatting the data.

    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")
    

    1.1 Formatting the datasets for analysis.

    bran_finance = brands.merge(finance, on ='product_id')
    fin_bran_info = bran_finance.merge(info,on ='product_id')
    fin_bran_info_rev = fin_bran_info.merge(reviews , on ='product_id')
    
    fin_bran_info_rev.dropna(inplace = True)

    2. Sales performance of Adidas and Nike products

    What is the volume of products and average revenue for Adidas and Nike products based on listing price quartiles?

    • Find the volume of products and associated revenue for Adidas and Nike products, split based on "listing_price" quartiles.
    # (a) Creating a column in the DataFrame called price_label
    
    fin_bran_info_rev['price_label'] = pd.qcut(fin_bran_info_rev['listing_price'], q=4, labels=['Budget', 'Average', 'Expensive', 'Elite'])
    
    # Group the data by brand and price_label, and calculate the number of products and mean revenue
    adidas_vs_nike = adidas_nike.groupby(['brand', 'price_label'], as_index=False).agg(num_products=('price_label', 'count'), mean_revenue=('revenue', 'mean')).round(2).reset_index(drop=True)

    3. Finding the relationship between product description lengths, ratings, and reviews

    Split product description length into bins and assign labels, before calculating the average rating and number of reviews for each range of description length.

    Do any differences exist between the word count of a product's description and its mean rating?

    3.1 Finding the length of each product description

    # Find the largest description_length
    max(fin_bran_info_rev["description"].str.len())
    
    # Store the length of each description
    fin_bran_info_rev["description_length"] = fin_bran_info_rev["description"].str.len()
    
    # Upper description length limits
    lengthes = [0, 100, 200, 300, 400, 500, 600, 700]
    
    # Description length labels
    labels = ["100", "200", "300", "400", "500", "600", "700"]
    
    # Cut into bins
    fin_bran_info_rev["description_length"] = pd.cut(fin_bran_info_rev["description_length"], 
    bins=lengthes, labels=labels)
    
    # Group by the bins
    description_lengths = fin_bran_info_rev.groupby("description_length", as_index=False).agg(
        mean_rating=("rating", "mean"), 
        num_reviews=("reviews", "count")
    ).round(2)

    4. Comparing footwear and clothing products.