Pyhton_Sentiment_Analyis_Cust_Segmentation

Customer Behavior Analysis using Python (Sentiment Analysis + RFM Segmentation)

View Project

Motivation

Understanding customer behavior is vital for any e-commerce business aiming to improve user experience, increase retention, and boost sales. While customer reviews provide emotional feedback, transactional data reveals behavioral patterns. This project combines both:

By integrating these perspectives, we deliver actionable insights for improving product offerings, delivery experience, and personalized marketing.


Dataset

The dataset is a blend of transactional and textual feedback, consisting of the following key features:

Source: Google Analytics API and customer review systems
Time Period: Dec 2023 – May 2025


Project verview

We approached this analysis in two major parts:

  1. Sentiment Analysis with VADER
    To automatically classify thousands of customer reviews into detailed emotional categories.

  2. Customer Segmentation with RFM & K-Means
    To profile customers based on their purchase recency, frequency, and monetary value.

Together, these methods offer a 360° view of customer behavior — what they feel and how they act.


Methodology

Sentiment Analysis (NLP-VADER)

Example

Visualizations

Polarity distribution

Max Score 0.8047
Min Score -0.6369

We used the compound score from VADER to classify each review into five sentiment categories:

Sentiment category bar chart

Bar Chart: Count of reviews in each sentiment category (Positive, Mixed Positive, Neutral, Mixed Negative, Negative).
Helps identify which sentiments are most common among customers


Customer Segmentaion (RFM + K-Means)</b>

Engineered RFM metrics:

Visualizations

RFM score

Cluster distribution

Segment-wise count chart


Tools & Libraries

Sentiment Analysis Customer Segmentation
Python Python
NLTK (VADER) Pandas, NumPy
Pandas Scikit-learn (KMeans)
Matplotlib, Seaborn Matplotlib, Seaborn
Jupyter Notebook Jupyter Notebook

Key Outcomes


Conclusion

This combined project showcases how textual feedback and purchase behavior can be jointly analyzed to drive customer-centric decisions. The sentiment layer surfaces emotional trends, while RFM clustering uncovers structural segments in the customer base.