Practice in Time Series Analysis: How I Screen Out Seasonal Product Categories

Brian Chan
6 min readOct 1, 2023

In e-commerce, data analysis is vital for driving business growth and optimizing strategies. Identifying seasonal trends in product categories helps develop targeted upselling strategies for increased revenue.

Recently, I was asked to find out the categories or products that have seasonality in sales. So that the commercial team can make use of those insights to boost sales on our e-commerce platform. As there are several hundred categories and several thousand products on our website, it is not efficient to check the sales chart for all categories using eyeball. Therefore, I decided to design a simple approach to complete this task.

In this article, I will walk you through a step-by-step approach to how I screen out the categories (or products) that have seasonal effects on our e-commerce website.

Data Acquisition & Transformation

I queried the monthly sales for each product within the last 3 years from the database. The dataset was desensitized and looks like below:

Sales Table

Then I transformed it into a pivot table to display the monthly sales of each category along the column, like this:

cat_sales = df.pivot_table(index='cat_name', columns=['year','month'], values='sales', aggfunc='mean')
Sales Pivot Table

In the pivot table, I used the mean as the aggregation function to remove the influence of product count within a category. Let’s take, for instance, category 101. Suppose there were 10 products on sale in August, resulting in sales of $10,000, and 20 products on sale in September, with sales totaling $20,000. The increase in sales during September could be solely attributed to the higher number of products on sale, without necessarily indicating an improvement in the category’s performance during that month. Consequently, using the mean (or median) in the table allows for a more meaningful comparison of…

--

--