Customer Segmentation for E-commerce using KMeans (Python Flask)

Understanding your customers is key to growing your online business. This project leverages KMeans Clustering, a machine learning algorithm, to automatically segment your customers based on shopping behavior like spending score, income, and shopping frequency.

Built using Python, Flask, and Tailwind CSS, this project is perfect for:

  • Final-year students in Data Science or Machine Learning
  • E-commerce startups or marketers looking to understand customer types
  • Beginners learning Flask web apps + ML integration

📥 Download Customer Segmentation Project

Click Here to Download Full Project with Source Code (ZIP)

Features of This Project:

  • 🧮 Customer Clustering using KMeans Algorithm

  • 📊 Interactive Dashboards with visualizations:

    • Elbow Method Plot

    • PCA 2D and 3D Graphs

    • Pie Chart & Bar Chart for Customer Type Distribution

  • 🔍 Silhouette Score to measure clustering performance

  • 🧑‍💼 Easy-to-understand UI for shop owners

  • 👨‍💻 Toggle for Data Science View (Detailed technical plots)

  • ⬇️ CSV Export of clustered customers with segment labels:

    • Budget Shoppers

    • High Spenders

    • Occasional Buyers

    • Loyal Customers

Technologies Used:

  • Python 3.x
  • Flask Web Framework
  • Pandas, NumPy, Scikit-learn
  • Matplotlib, Seaborn
  • Tailwind CSS (for UI)
  • HTML5 / Jinja2

📝 How It Works:

  1. User uploads a CSV file with customer data.
  2. Backend preprocesses it and applies KMeans clustering.
  3. Results are shown visually with charts and segment labels.
  4. Optionally, users can download the analyzed data for marketing insights.

What You Get in the ZIP:

  • Complete source code (app.py, templates, static files)
  • Pre-built HTML with Tailwind UI
  • Dataset and sample input
  • Readme + setup instructions
  • Labeled output CSV
  • Project Report + PPT

Download Full Project with Source Code (ZIP)

Posted in Machine Learning Projects With Source Code.