Clustering Households into Rural and Urban Segments using Spending Patterns — Exploratory Data Analysis
This repository hosts an in-depth Exploratory Data Analysis (EDA) on the Ground Truth Household dataset, aimed at uncovering patterns in household expenditure, transaction behavior, and sector-wise trends.
The analyses are performed in the Jupyter Notebook: eda_ground_truth_households.ipynb
This EDA project follows a structured pipeline:
- Data Loading & Cleaning
- Descriptive Statistics & Distribution Analysis
- Sector-based Comparative Visuals
- Correlation Analysis
- Clustering & Pattern Discovery
Visualizations include histograms, boxplots, scatterplots, and heatmaps to illustrate key insights. Performing unsupervised learning using the KMeans clustering algorithm to classify households into two segments — likely Rural and likely Urban — based on spending and transaction behavior. he dataset contains household-level parameters:
Total expenditure
Average transaction value
Total transactions
Unique items purchased
Get up and running in a few minutes:
git clone https://github.com/11saishiva/eda-ground-truth-households.git
cd eda-ground-truth-householdspython -m venv venv
source venv/bin/activate # macOS / Linux
venv\Scripts\activate # Windows
pip install -r requirements.txtjupyter notebook eda_ground_truth_households.ipynb- total_expenditure: Overall spending per household
- avg_transaction_value: Average amount per transaction
- total_transactions: Number of transactions per household
- common_id: Unique ID for each household
-> Households in different sectors exhibit varying spending distributions. -> Average transaction values correlate strongly with total expenditure. -> Clustering analysis reveals distinct behavior groups based on transaction patterns.
-> spend_per_capita threshold range = total_expenditure/household_size
-> transactions_per_capita threshold range = total_transactions/household_size
Scatterplot visualizing the households classified as Rural or Urban - Predictions
Accuracy of spend_per_capita threshold and transactions_per_capita threshold represented as a heatmap
This project is shared under the MIT License. Feel free to use, modify, and distribute freely.



