Black Friday Analysis Using Python
By: Asep Saputra
Tags: Customer, Sales Analytics, Sales, Analysis, Python

Black Friday Analysis Using Python

Analysis of Sales Data Based on Customer Demographics Using Python!

Photo by T.H. Chia on Unsplash

Overview

At this time we will analyze sales with Customer demographic analysis eg city, age, gender… The purpose of this process is to provide more information about our data so that the marketing team is prepared to intensify efficiency based on the data and information we will provide!

Even though Ithakk is simple to make a full page as a complete report on this subject, From this core teaches you how exploratory analysis is how you tell the story of how to make information in your mind:

Gender

Age

City

Occupation

Product

Stability

Data Used

The data used is the Black Friday data from Kaggle, you can find the data on here!

Description

What is Black Friday?

The earliest known use of “Black Friday” to be recognized on the day after Thanksgiving occurred in the journal, Factory Management and Maintenance, for November 1951, and again in 1952. Here here is the practice of workers calling sick the following day. Thanksgiving, by having a four day weekend. However, this use was unsuccessful. Around the same time, the terms “Black Friday” and “Black Saturday” came into use by police in Philadelphia and Rochester to describe the crowds and traffic jams that accompany the start of the Christmas shopping season. In 1961, the city and merchants of Philadelphia were trying to improve conditions, and a public relations expert was branding “Big Friday” and “Big Saturday”; but these terms were soon forgotten. [1]

Analysis using Python

From here we will start the analysis process!

Import Library

import numpy as np

import pandas as pd

import os

import matplotlib.pyplot as plt

import seaborn as sns

%matplotlib inline

Read Data

df = pd.read_csv('BlackFriday.csv')

Get Information From Data

Head

df.head()

Head of Black Friday Datasets

Info

df.info()

Head of Black Friday Datasets

Describe

Describe For Numerical

df.describe()

Describe For Numerical Black Friday Datasets

Describe For Category

df.describe(include='O')

Describe For Category Black Friday Datasets

Collect Information From:

Gender

explode = (0.09,0) fig1, ax1 = plt.subplots(figsize=(12,7))

ax1.pie(df['Gender'].value_counts(), explode=explode,labels=['Male','Female'], autopct='%1.1f%%',shadow=True, startangle=90) ax1.axis('equal')

plt.tight_layout()

plt.legend()

plt.show()

Value Counts of Gender on Black Friday Datasets

Men’s purchasing power is greater than women’s purchasing power, even under normal circumstances. This is likely to affect the owner of the money, but the number of men who come to the shop is quite high. About 75% of customers have made sales to men of all ages, Men generally point to a product priced at 8000–12,000, we may have made sales worth over 4 billion to men and over 1 billion to women.

Age

fig1, ax1 = plt.subplots(figsize=(12,7))

sns.countplot(df['Age'],hue=df['Gender']);

Gender on Black Friday Datasets

From the results obtained we can consider that our store’s target age group is the 26–35 year age group, we have achieved sales of more than 3 billion in the 26–45 year age group.

City

explode = (0.1, 0, 0)

fig1, ax1 = plt.subplots(figsize=(12,7)) ax1.pie(df['City_Category'].value_counts(),explode=explode, labels=df['City_Category'].unique(), autopct='%1.1f%%', shadow=True, startangle=90)

ax1.axis('equal')

plt.tight_layout()

plt.legend()

plt.show()

Value Counts of City on Black Friday Datasets



explode = (0.1, 0, 0)

fig1, ax1 = plt.subplots(figsize=(12,7)) ax1.pie(df.groupby('City_Category')['Purchase'].sum(),explode=explode, labels=df['City_Category'].unique(), autopct='%1.1f%%', shadow=True, startangle=90)

ax1.axis(‘equal’)

plt.tight_layout()

plt.legend()

plt.show()

Sum of City on Black Friday Datasets

fig1, ax1 = plt.subplots(figsize=(12,7))

sns.countplot(df['City_Category'],hue=df['Age'])

City Category on Black Friday Datasets

It turns out that unexpectedly the highest sales don’t come in the number of purchases, people from Area B have more purchasing power than others, and bigger sales are obtained from people from Area C

Take a look at the comments, sometimes we have to identify the appropriate words and not mix with them as I am doing here. I want to point out that sales do not reflect purchasing power, but that the number of participants reflects purchasing power because the data are individual sales. Sales in the city reflect purchasing power.

explode = (0.1, 0)

fig1, ax1 = plt.subplots(figsize=(12,7)) ax1.pie(df[‘Marital_Status’].value_counts(),explode=explode, labels=['Yes','No'], autopct='%1.1f%%', shadow=True, startangle=90)

ax1.axis('equal')

plt.tight_layout()

plt.legend()

plt.show()

Yes No of Marital Status on Black Friday Datasets

City A is the largest city followed by B and then C, the age distribution on the procurement map is very close, here we have to focus on the average occupational category 36–45.

From the results we can also see that most of the customers are more than 60% married, I see that the strategy of targeting families to ensure more clients will be successful.

Stability

labels=[‘First Year’,’Second Year’,’Third Year’,’More Than Four Years’,’Geust’] explode = (0.1, 0.1,0,0,0)

fig1, ax1 = plt.subplots(figsize=(12,7)) ax1.pie(df.groupby(‘Stay_In_Current_City_Years’)[‘Purchase’].sum(),explode=explode, labels=labels, autopct=’%1.1f%%’, shadow=True, startangle=90)

ax1.axis(‘equal’)

plt.tight_layout()

plt.legend()

plt.show()

Sum of Stability on Black Friday Datasets

labels=[‘First Year’,’Second Year’,’Third Year’,’More Than Four Years’,’Geust’] #label=[‘Underage 0–17’,’Retired +55',’Middleage 26–35',’46–50 y/o’,’Oldman 51–55',’Middleage+ 36–45',’Youth’] explode = (0.1, 0.1,0,0,0)

fig1, ax1 = plt.subplots(figsize=(12,7)) ax1.pie(df[‘Stay_In_Current_City_Years’].value_counts(),explode=explode, labels=labels, autopct=’%1.1f%%’, shadow=True, startangle=90)

ax1.axis(‘equal’)

plt.tight_layout()

plt.legend()

plt.show()

Value Counts of Stability on Black Friday Datasets

From the results obtained we can note that purchasing power is closely related to Employment in some cases as the first class of the table, but there are some differences that we can check when examining the number of purchases and the value of these purchases.

Occupation

fig1, ax1 = plt.subplots(figsize=(12,7))

df[‘Occupation’].value_counts().sort_values().plot(kind=’bar’)

Value Counts of Occupation on Black Friday Datasets

Products and Categories

fig1, ax1 = plt.subplots(figsize=(12,7)) df.groupby(‘Product_ID’)[‘Purchase’].count().nlargest(10).sort_values().plot(kind=’barh’)

Count of Products and Categories on Black Friday Datasets

fig1, ax1 = plt.subplots(figsize=(12,7)) df.groupby(‘Product_ID’)[‘Purchase’].sum().nlargest(10).sort_values().plot(kind=’barh’)

Sum of Products and Categories on Black Friday Datasets

The results obtained show the top 10 products for 10 benefits and the first 10 categories for each product.

Reference

[1] https://en.wikipedia.org/wiki/Black_Friday_(shopping)

Gain Access to Expert View — Subscribe to DDI Intel