Flipkart Sale Analysis using Python

Flipkart introduces a sale every year during the festive season in India. This sale is known as the Big Billion Days sale. The focus of the sale is on electronics of every kind, including flagship smartphones. So, if you want to analyze the products and offers on a sale of an e-commerce platform, this article is for you. In this article, I will take you through the task of Flipkart Sale Analysis using Python.

Flipkart Sale Analysis

To analyze the Flipkart Big Billion Days sale, I researched and found an ideal data set on Kaggle. The dataset contains all the information about all the products in the sale. As this sale started on September 23, we can analyze the first day of the sale as the most attractive offers were offered on the first day by Flipkart.

For this task of Flipkart Sale Analysis, I will only choose the data about the sale on smartphones on the first day of the sale by Flipkart. You can download the dataset I am using for this task here. You can also use the complete dataset of Flipkart sale here.

In the section below, I will take you through Flipkart’s sale analysis by analyzing the offers on the sale of smartphones.

Flipkart Sale Analysis using Python

Let’s start the task of Flipkart sale analysis by importing the necessary Python libraries and the dataset:

import pandas as pd
import numpy as np
import plotly.express as px
import plotly.graph_objects as go

data = pd.read_csv("23_09_2022.csv")
print(data.head())
                                  name  offer_price  original_price  off_now  \
0       APPLE iPhone 13 (Blue, 128 GB)        57990           69900  17% off   
1      APPLE iPhone 11 (White, 128 GB)        41990           48900  14% off   
2   APPLE iPhone 13 (Midnight, 128 GB)        57990           69900  17% off   
3                             IAIR D25         1098            1699  35% off   
4  APPLE iPhone 13 (Starlight, 128 GB)        58990           69900  15% off   

   total_ratings  total_reviews  rating  \
0          13052           1036     4.6   
1          96244           7044     4.6   
2          13052           1036     4.6   
3             11              8     4.1   
4          13052           1036     4.6   

                                         description  \
0  ['128 GB ROM', '15.49 cm (6.1 inch) Super Reti...   
1  ['128 GB ROM', '15.49 cm (6.1 inch) Liquid Ret...   
2  ['128 GB ROM', '15.49 cm (6.1 inch) Super Reti...   
3  ['32 MB RAM | 32 MB ROM', '4.32 cm (1.7 inch) ...   
4  ['128 GB ROM', '15.49 cm (6.1 inch) Super Reti...   

                         created_at  
0  2022-09-23 22:37:42.702432+05:30  
1  2022-09-23 22:37:42.703432+05:30  
2  2022-09-23 22:37:42.703432+05:30  
3  2022-09-23 22:37:42.703432+05:30  
4  2022-09-23 22:37:42.704431+05:30 

The discount column mentioned in the dataset contains string values. So I will create a new discount column by calculating the discount offered by Flipkart on every smartphone:

data["Discount"] = (data['original_price'] - data['offer_price']) / data['original_price'] * 100

Now let’s have a look at the top deals on smartphones offered by Flipkart on the sale:

top_deals = data.sort_values(by="Discount", ascending=False)
deals = top_deals["name"][:15].value_counts()
label = deals.index
counts = top_deals["Discount"][:15].values
colors = ['gold','lightgreen']
fig = go.Figure(data=[go.Pie(labels=label, values=counts)])
fig.update_layout(title_text='Highest Discount Deals in the Flipkart Big Billion Days Sale')
fig.update_traces(hoverinfo='label+percent', textinfo='value', textfont_size=30,
                  marker=dict(colors=colors, line=dict(color='black', width=3)))
fig.show()
Highest Discount Deals in the Flipkart Big Billion Days Sale

So the top deals on smartphones had discounts of around 60%. Some popular smartphones from Samsung were offered with a discount of around 50%. Now let’s have a look at some of the highest-rated smartphones on Flipkart on this sale:

highest_rated = data.sort_values(by="rating", ascending=False)
deals = highest_rated["name"][:10].value_counts()
label = deals.index
counts = highest_rated["rating"][:10].values
colors = ['gold','lightgreen']
fig = go.Figure(data=[go.Pie(labels=label, values=counts)])
fig.update_layout(title_text='Highest Rated Discount Deals in the Flipkart Big Billion Days Sale')
fig.update_traces(hoverinfo='label+percent', textinfo='value', textfont_size=30,
                  marker=dict(colors=colors, line=dict(color='black', width=3)))
fig.show()
Highest Rated Discount Deals in the Flipkart Big Billion Days Sale

So we can see the highest-rated products from all price segments in this sale. Now let’s have a look at the most expensive smartphone deals in the sale:

most_expensive = data.sort_values(by="offer_price", ascending=False)
deals = most_expensive["name"][:10].value_counts()
label = deals.index
counts = most_expensive["offer_price"][:10].values
colors = ['gold','lightgreen']
fig = go.Figure(data=[go.Pie(labels=label, values=counts)])
fig.update_layout(title_text='Most Expensive Offers in the Flipkart Big Billion Days Sale')
fig.update_traces(hoverinfo='label+percent', textinfo='value', textfont_size=30,
                  marker=dict(colors=colors, line=dict(color='black', width=3)))
fig.show()
Most Expensive Offers in the Flipkart Big Billion Days Sale

All the expensive offers on smartphones in the sale were on Apple iPhones.

The Daily Cost of Sale on Smartphones to Flipkart

The discounts offered are expenses for a business. A business reduces the price of a product to increase its sale of the products. Discount fall under the category of promotional costs.

We are using the Flipkart sale data on smartphones on the first day of the sale. So let’s calculate the cost of this sale to Flipkart on just smartphones on the first day of the sale:

label = ["Total of Offer Prices in Sales", "Total of Original Prices (MRP)"]
counts = [sum(data["offer_price"]), sum(data["original_price"])]
colors = ['gold','lightgreen']
fig = go.Figure(data=[go.Pie(labels=label, values=counts)])
fig.update_layout(title_text='Total Discounts Offered Vs. MRP')
fig.update_traces(hoverinfo='label+percent', textinfo='value', textfont_size=30,
                  marker=dict(colors=colors, line=dict(color='black', width=3)))
fig.show()
Total Discounts Offered Vs. MRP
print("Cost of big billion days sale to flipkart on smartphones = ", 12876594 - 10522822)
Cost of big billion days sale to flipkart on smartphones =  2353772

So the cost of a discount to Flipkart on just smartphones will be ₹23,53,772 for just one quantity of all the smartphones offered in the sale.

Summary

So this is how you can analyze the Flipkart Big Billion Days Sale. Feel free to take inspiration from this article to analyze more of the Flipkart sale on the complete dataset here. I hope you liked this article on Flipkart sale analysis using Python. Feel free to ask valuable questions in the comments section below.

Aman Kharwal
Aman Kharwal

I'm a writer and data scientist on a mission to educate others about the incredible power of data📈.

Articles: 1501

Leave a Reply