Update README.me
#️⃣ 1. Dataset Overview
This project analyzes an e-commerce customer behavior dataset.
The goal of the EDA was to explore user behavior, identify patterns related to purchases, detect anomalies, and understand factors that influence total spending.
The insights support a future classification task (e.g., predicting customer type or purchase likelihood).
#️⃣ 2. Data Cleaning
Cleaning Steps Performed
The following steps ensured a clean and consistent dataset:
Missing Values
Checked using df.isnull().sum() – no missing values found.
Duplicate Rows
Checked using df.duplicated().sum() – no duplicates detected.
Parsing Dates
Converted the Date column into a proper datetime format.
Normalization & Scaling Checks
Reviewed ranges using df.describe() – no scaling issues.
Invalid Values
Checked Age, Session_Duration_Minutes, Delivery_Time_Days for negative or unrealistic values – all valid.
Final Dataset
After cleaning, the dataset contained no missing values, no duplicates, and all numeric values were within valid ranges.
Code Used
import pandas as pd
df = pd.read_csv("ecommerce_customer_behavior_dataset.csv")
df.isnull().sum()
df.duplicated().sum()
df['Date'] = pd.to_datetime(df['Date'], errors='coerce')
df.describe()
df['Age'].describe()
df['Session_Duration_Minutes'].describe()
df['Delivery_Time_Days'].describe()
df = df[df['Age'] > 0]
df = df[df['Session_Duration_Minutes'] >= 0]
df = df[df['Delivery_Time_Days'] >= 0]
df = df.drop_duplicates()
#️⃣ 3. Outlier Detection & Handling (IQR Method)
Method
The IQR method was used:
IQR = Q3 – Q1
Outliers are values outside:
lower_bound = Q1 - 1.5IQR
upper_bound = Q3 + 1.5IQR
Columns Checked
Total_Amount
Unit_Price
Session_Duration_Minutes
Decision
High values in this dataset represent real large purchases.
Therefore, all outliers were kept.
Code
cols = ['Total_Amount', 'Unit_Price', 'Session_Duration_Minutes']
for col in cols:
Q1 = df[col].quantile(0.25)
Q3 = df[col].quantile(0.75)
IQR = Q3 - Q1
lower = Q1 - 1.5 * IQR
upper = Q3 + 1.5 * IQR
outliers = df[(df[col] < lower) | (df[col] > upper)]
print(col, "outliers:", outliers.shape[0])
#️⃣ 4. Descriptive Statistics
Key Findings
Average customer age ≈ 35.
Unit_Price & Total_Amount have a big gap between mean and median → some very expensive items affect the mean.
Quantity median = 2 → most purchases are small.
Average rating ≈ 4.
Correlations
Unit Price ↔ Total Amount: strong correlation (0.79)0.33)
Quantity ↔ Total Amount: moderate correlation (
Most other correlations are weak.
Code
df.describe()
mean_values = df.mean(numeric_only=True)
median_values = df.median(numeric_only=True)
correlations = df.corr(numeric_only=True)
print(mean_values)
print(median_values)
print(correlations)
#️⃣ 5. Visualizations
Age Distribution
Total Purchase Amount Distribution
Unit Price vs Total Amount
Session Duration Distribution
#️⃣ 6. Research Questions & Answers
Q1: Is there a relationship between session duration and total purchase amount?
sns.scatterplot(x=df['Session_Duration_Minutes'], y=df['Total_Amount'])
Insight:
Longer session duration tends to correlate with slightly higher purchase amounts.
Q2: Do returning customers spend more than new customers?
avg_spending = df.groupby('Is_Returning_Customer')['Total_Amount'].mean()
Insight:
Returning customers spend more on average.
Q3: Is there a relationship between quantity and total purchase amount?
sns.scatterplot(x=df['Quantity'], y=df['Total_Amount'])
Insight:
As quantity increases, total amount increases—moderate correlation.
Q4: What is the age distribution of customers?
sns.histplot(df['Age'], bins=20, kde=True)
Insight:
Most customers are between 25–45, suggesting that the store’s main demographic is adults in their working years.
#️⃣ 7. Key Insights
Returning customers contribute significantly more revenue.
Session duration has a mild but visible impact on purchase amounts.
Price distribution suggests a few very expensive items dominating averages.
Age distribution centered around 30–40 → strong, predictable target group.
#️⃣ 8. Decisions Made
Kept outliers, as they represent real large purchases.
Fixed date format to enable time-based analysis.
Removed invalid values (negative numbers, if present).
No duplicates → dataset kept intact.
#️⃣ 9. Files Included
ecommerce_customer_behavior_dataset.csv — original dataset
Assignment_EDA.ipynb — notebook with full analysis
README.md — this file
📹 Presentation Video
A short presentation video summarizing the dataset, the EDA process, key insights, and lessons learned is included as part of this submission.
You can watch it here:
▶️ Click to view the presentation video
#️⃣ 10. Final Notes (Reflections)
This project demonstrated the importance of structured EDA before modeling.
Challenges included choosing meaningful questions and validating numeric values.
The analysis helped uncover core behavioral patterns that can directly support future classification tasks.