Customer Personality Analysis is a detailed analysis of a company’s ideal customers. It helps a business to better understand its customers and makes it easier for them to modify products according to the specific needs, behaviours and concerns of different types of customers. In this article, I’m going to introduce you to a data science project on customer personality analysis with Python.
Customer Personality Analysis
Customer personality analysis helps a business to modify its product based on its target customers from different types of customer segments. For example, instead of spending money to market a new product to every customer in the company’s database, a company can analyze which customer segment is most likely to buy the product and then market the product only on that particular segment.
The most important part of a customer personality analysis is getting the answers to questions such as:
- What people say about your product: what gives customers’ attitude towards the product.
- What people do: which reveals what people are doing rather than what they are saying about your product.
In the section below, I’ll walk you through a data science project on analyzing customer personality with python. Here I will be using a dataset that contains data collected from a marketing campaign, where our task is to predict how different customer segments will respond for a particular product or service.
Customer Personality Analysis with Python
Now let’s start with the task of customer personality analysis with Python. Since this is a segmentation task, we will use clustering to summarize customer segments and then we will also use the Apriori algorithm here. Now let’s start by importing the necessary Python libraries and the dataset:
Before moving further, let’s have a look at the data by using the automatic EDA technique:
from dataprep.eda import plot, plot_correlation, create_report, plot_missing plot(data)
Now I will create some new features in the dataset to define the customer personalities as a part of data preparation:
Now I will remove the outliers and the missing values in the dataset:
To take a look at the clustering of clients in the dataset, I’ll define the segments of the clients. Here we will use 4 equally weighted customer segments:
- Stars: Old customers with high income and high spending nature.
- Neet Attention: New customers with below-average income and low spending nature.
- High Potential: New customers with high income and high spending nature.
- Leaky Bucket: Old customers with below-average income and a low spending nature.
In the code section below, I will first normalize the data and then I will create customer clustering according to the metrics defined above:
Now let’s plot this data to have a look at the clustering of customers:
Data Preparation for Customer Personality Analysis
Now I will prepare the data for the Apriori algorithm. Here I will be defining three segments of the customers according to the age, income and seniority:
Now I will define new segments according to the spending of customers on each product which will be based on:
- Non Buyer
- Low Buyer
- Frequent Buyer
- Biggest Buyer
The Apriori algorithm is the simplest technique to identify the underlying relationships between different types of elements. The idea behind this algorithm is that all nonempty subsets of a frequent category must also be frequent. Here I will be using the Apriori algorithm for the task of customer personality analysis with Python. Here I will use this algorithm to identify the biggest customer of wines:
So according to the output and overall analysis conducted on this data science project on customer personality analysis with Python, we can conclude that the biggest customers of wines are:
- Customers with an average income of around $69,500.
- Customers with an average total spend of approximately $1,252.
- Customers registered with the company for approximately 21 months.
- Customers with a graduate degree.
- And customers who are also heavy consumers of meat products.
I hope you liked this article on Customer Personality Analysis with Python. Feel free to ask your valuable questions in the comments section below.