This project performs end-to-end data cleaning, exploratory data analysis (EDA), visualization, and data transformation on a messy e-commerce sales dataset using Python. The goal is to take raw, inconsistent data and turn it into a clean, analysis-ready dataset while uncovering key patterns in customer purchasing behavior.
To clean and analyze an E-commerce Customer dataset using Python and perform Exploratory Data Analysis (EDA) to extract meaningful business insights.
- Input file:
messy_ecommerce_sales_data.csv - Output file:
Cleaned_Ecommerce_Data.csv(generated after cleaning) - Columns: ID, Customer_Name, Order_ID, Order_Date, Product, Category, Quantity, Price, Payment_Method, Status, Total
Note: If the raw dataset isn't your own to redistribute, consider linking to its original source instead of uploading it directly.
Each column was cleaned individually following an identify → solve → verify workflow:
| Column | Issues Found | Fix Applied |
|---|---|---|
| ID | Duplicate values | Removed duplicate rows |
| Customer_Name | Duplicate values | Removed duplicate rows |
| Order_ID | None | No cleaning needed |
| Order_Date | Invalid formats, missing values | Converted to datetime, filled missing with mode, standardized format (dd-mm-yyyy) |
| Product | Inconsistent casing | Converted to title case |
| Category | Inconsistent casing, spelling variants, missing values | Standardized text, merged spelling variants (e.g. "Electronic" → "Electronics"), filled missing with mode |
| Quantity | Invalid/negative values | Converted to numeric, replaced negatives with NaN, filled missing with mode |
| Price | Currency symbols, invalid/negative values, outlier | Removed $ symbol, converted to numeric, replaced negatives with NaN, filled missing with median, removed outlier row (price = 10000) |
| Payment_Method | None | No cleaning needed |
| Status | None | No cleaning needed |
| Total | Negative values, missing values | Replaced negatives with NaN, filled missing with median |
The following visualizations were created to explore relationships in the cleaned data:
- Scatter Plot — Quantity vs Total
- Bar Chart — Order count by Payment Method
- Horizontal Bar Chart — Total sales by Payment Method
- Pie Chart — Order distribution by Category
- Seaborn Bar Plot — Price by Category and Payment Method
- Box Plot — Quantity distribution by Category
- Correlation Heatmap — Price, Quantity, and Total
- Price and Total show a moderate positive correlation (0.64)
- Quantity and Total show a moderate positive correlation (0.58)
- Price and Quantity have a very weak correlation (0.07)
- Total is mainly driven by both Price and Quantity together
- Label Encoding using
sklearn.preprocessing.LabelEncoder - One-Hot Encoding using
pandas.get_dummies()onPayment_MethodandStatuscolumns (with and withoutdrop_first)
- Python 3
- pandas
- numpy
- matplotlib
- seaborn
- scikit-learn (LabelEncoder)
- Clone this repository
git clone <your-repo-url> cd <repo-folder>
- Install dependencies
pip install pandas numpy matplotlib seaborn scikit-learn
- Open the notebook
or open it directly in Google Colab.
jupyter notebook Home_Based_Project.ipynb
ecommerce-customer-eda/
│
├── Home_Based_Project.ipynb # Main notebook (cleaning, EDA, visualization, transformation)
├── data/
│ ├── messy_ecommerce_sales_data.csv # Raw input dataset (optional to include)
│ └── Cleaned_Ecommerce_Data.csv # Cleaned output dataset
├── images/ # (optional) exported chart screenshots for the README
├── README.md
└── requirements.txt # Python dependencies
Maira Rehmat ID: AI-817677
This project is open source and available for educational use.