Customer Loyalty Analysis: Data-Driven Insights for Business Growth

Project Type: Data Analytics | Tools Used: Python & R

Carried out At: LSE Data Analytics Career Accelerator

OVERVIEW

In a competitive market, businesses need to leverage data to improve customer retention. This project applied end-to-end analytics — from data preprocessing and machine learning to NLP and visualisation — to uncover loyalty trends, segment customer groups, and forecast engagement.

Using Python and R, raw datasets were cleaned, modelled, and visualised to generate actionable insights. These insights enabled targeted loyalty strategies based on spending behavior, sentiment analysis, and predictive forecasting. The outcome was a detailed understanding of customer behavior patterns, allowing for more effective marketing and retention initiatives.

  • Cleaned, structured, and validated datasets for analytical accuracy using Pandas and dplyr.

  • Implemented K-Means clustering, multiple linear regression, and decision tree models in Python and R to segment customers and forecast loyalty trends.

  • Extracted meaningful insights from customer reviews using NLTK and Sentiment Intensity Analyzer in Python.

  • Created compelling visualisations using Matplotlib and ggplot2,

  • Applied log transformations, outlier handling, and feature scaling to enhance predictive model performance.

  • Developed models to predict customer loyalty trends and spending behaviors based on historical data.

Customer Loyalty Analysis & Forecasting

Tools: Python (Pandas, Matplotlib), R (dplyr, ggplot2), Scikit-learn, NLP, K-Means, Linear Regression

Methodology & Tools Used:

Data Cleaning & QA

  • Handled missing values and standardised categorical fields using Pandas (Python) and dplyr (R).

  • Detected and corrected outliers in loyalty metrics via IQR method and boxplots.

  • Performed exploratory data analysis (EDA) to uncover trends and feature distributions.

    Customer Segmentation (K-Means Clustering)

  • Clustered customers based on spending and loyalty behavior.

  • Identified high-value customer groups for targeted rewards and personalised campaigns.

  • Visualised clusters to support marketing strategy development.

    Sentiment Analysis (NLP)

  • Extracted sentiment from customer reviews using NLP techniques.

  • Key themes: customers praised fast checkout and personalised offers; complaints centred on reward redemption.

  • Built word clouds and sentiment score distributions to guide service improvements.

    Predictive Modelling (Loyalty Forecasting)

  • Built a multiple linear regression model to predict loyalty points using income and spending data.

  • Explored decision tree models to improve accuracy and interpretability.

  • Identified seasonal trends in engagement to inform promo timing.

Deliverables:

  • Cleaned, annotated Python & R scripts for reproducible analysis.

  • Interactive visual summaries (e.g. predicted vs. actual loyalty points graph, cluster heatmaps).

  • Business recommendations for loyalty program design and offer timing.