Skip to content

About

πŸ“Š Exploratory Data Analysis (EDA), Data Cleaning & Preprocessing in Action πŸš€ In this project walkthrough, I worked through a complete data preprocessing and EDA workflow using Python, Pandas, Matplotlib, and Seaborn. πŸ” The process included: βœ… Loading and inspecting the dataset βœ… Understanding data structure, dimensions, and data

Resources

Stars

3 stars

Watchers

0 watching

Forks

Latest commit

Β 

History

10 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation


🧭 Quick Navigations

πŸš€ πŸ“ πŸ”¬ πŸ“Š πŸ› οΈ
Overview Architecture Pipeline Visuals Run It

🎯 Overview

Raw data is messy. Good models need clean data. This project walks through a complete Exploratory Data Analysis (EDA), Data Cleaning, and Preprocessing workflow, turning a raw dataset into a reliable, analysis-ready one.

        β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
       β•±β”‚   RAW DATA  ➜  CLEAN DATA  ➜  INSIGHTS   β”‚β•²
      β•± β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β•²
     β•±   β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘   β•²
    β•±____β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’_____β•²
    β•²β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β•±
     β•²___________   DATA  QUALITY  LAYER   ___________β•±

βœ… What this project covers

  • πŸ“₯ Loading and inspecting the dataset
  • 🧱 Understanding structure, dimensions, and data types
  • 🩹 Handling missing values and checking data quality
  • πŸ“ˆ Descriptive statistics for key features
  • πŸ“Š Distributions with histograms and count plots
  • 🚨 Outlier detection using boxplots
  • πŸ”— Exploring relationships and patterns
  • πŸ€– Preparing the dataset for machine learning

πŸ—οΈ Project Architecture

Click-free, rendered natively by GitHub (Mermaid):

flowchart LR
    A[(πŸ“ Raw Dataset<br/>CSV / Excel)] --> B[πŸ“₯ Load & Inspect<br/>head, info, shape]
    B --> C[🧱 Understand Structure<br/>dtypes, dimensions]
    C --> D{🩹 Missing Values?}
    D -- Yes --> E[πŸ”§ Impute / Drop]
    D -- No --> F
    E --> F[πŸ“ˆ Descriptive Stats<br/>describe, value_counts]
    F --> G[πŸ“Š Univariate Analysis<br/>hist, countplot]
    G --> H[🚨 Outlier Detection<br/>boxplot, IQR]
    H --> I[πŸ”— Bivariate / Multivariate<br/>heatmap, pairplot]
    I --> J[βš™οΈ Preprocessing<br/>encode, scale]
    J --> K[(βœ… Clean Dataset<br/>ML-Ready)]

    style A fill:#ff7675,stroke:#d63031,color:#fff
    style K fill:#00b894,stroke:#00695c,color:#fff
    style D fill:#fdcb6e,stroke:#e17055,color:#000
    style H fill:#e17055,stroke:#d63031,color:#fff
Loading

🧊 Layered View (3D-style stack)

        β•±β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β•²
       β•±  LAYER 5 Β· ML-READY DATA   β•²        ← Output
      β•±β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β•²
     β•±  LAYER 4 Β· PREPROCESSING       β•²      ← Encode, scale
    β•±β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β•²
   β•±  LAYER 3 Β· VISUAL EXPLORATION      β•²    ← Plots, outliers
  β•±β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β•²
 β•±  LAYER 2 Β· CLEANING & QUALITY CHECKS   β•²  ← Missing, duplicates
β•±β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β•²
▏  LAYER 1 Β· RAW DATA INGESTION            β–•  ← Load & inspect
β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”β–”

πŸ”¬ Pipeline Explained (click to expand)

πŸ“₯ Step 1 Β· Load & Inspect the Data

Goal: Get a first feel for the dataset.

import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns

df = pd.read_csv("data/dataset.csv")

df.head()          # first look
df.tail()          # last rows
df.sample(5)       # random peek

πŸ’‘ Why it matters: You can't fix what you haven't seen.

🧱 Step 2 · Understand Structure, Dimensions & Data Types
print("Shape:", df.shape)
df.info()
print(df.dtypes)
print(df.columns.tolist())
Check Tells you
df.shape Rows Γ— columns
df.info() Non-null counts, dtypes, memory
df.dtypes Numeric vs categorical vs date

⚠️ Watch out: numbers stored as object, dates stored as strings.

🩹 Step 3 · Missing Values & Data Quality
# Count and percentage of missing values
missing = df.isnull().sum()
missing_pct = (missing / len(df) * 100).round(2)
print(pd.DataFrame({"Missing": missing, "Percent": missing_pct}))

# Visualize missingness
sns.heatmap(df.isnull(), cbar=False, cmap="viridis")
plt.title("Missing Value Map")
plt.show()

# Duplicates
print("Duplicates:", df.duplicated().sum())
df = df.drop_duplicates()

Common strategies

Situation Strategy
Numeric, roughly symmetric Fill with mean
Numeric, skewed Fill with median
Categorical Fill with mode
Too many missing (>40–50%) Consider dropping the column
df["numeric_col"] = df["numeric_col"].fillna(df["numeric_col"].median())
df["category_col"] = df["category_col"].fillna(df["category_col"].mode()[0])
πŸ“ˆ Step 4 Β· Descriptive Statistics
df.describe()                    # numeric summary
df.describe(include="object")    # categorical summary
df["category_col"].value_counts()
df.skew(numeric_only=True)       # distribution shape

🧠 Look at the gap between mean and median. A big gap hints at skew or outliers.

πŸ“Š Step 5 Β· Distributions (Histograms & Count Plots)
# Numeric features
df.hist(figsize=(14, 10), bins=30, edgecolor="black")
plt.tight_layout()
plt.show()

# Categorical features
plt.figure(figsize=(8, 5))
sns.countplot(data=df, x="category_col", palette="viridis")
plt.xticks(rotation=45)
plt.show()
Plot Best for
Histogram Shape of numeric data
KDE plot Smooth distribution
Count plot Category frequency / imbalance
🚨 Step 6 · Outlier Detection (Boxplots + IQR)
sns.boxplot(x=df["numeric_col"], color="skyblue")
plt.show()

# IQR method
Q1 = df["numeric_col"].quantile(0.25)
Q3 = df["numeric_col"].quantile(0.75)
IQR = Q3 - Q1
lower, upper = Q1 - 1.5 * IQR, Q3 + 1.5 * IQR

outliers = df[(df["numeric_col"] < lower) | (df["numeric_col"] > upper)]
print(f"Outliers found: {len(outliers)}")
   β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ”‚β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€      ●  ●
 lower      Q1      median     Q3       upper   outliers
 whisker                                whisker

Options: keep (if real), cap/winsorize, transform (log), or remove (if errors).

πŸ”— Step 7 Β· Relationships & Patterns
# Correlation heatmap
plt.figure(figsize=(10, 8))
sns.heatmap(df.corr(numeric_only=True), annot=True, cmap="coolwarm", fmt=".2f")
plt.title("Correlation Matrix")
plt.show()

# Pairwise relationships
sns.pairplot(df, hue="target_col")
plt.show()

# Numeric vs category
sns.boxplot(data=df, x="category_col", y="numeric_col")
plt.show()
βš™οΈ Step 8 Β· Prepare for Machine Learning
from sklearn.preprocessing import LabelEncoder, StandardScaler

# Encode categoricals
df = pd.get_dummies(df, columns=["category_col"], drop_first=True)

# Scale numerics
scaler = StandardScaler()
num_cols = df.select_dtypes(include="number").columns
df[num_cols] = scaler.fit_transform(df[num_cols])

# Save the clean dataset
df.to_csv("data/cleaned_dataset.csv", index=False)

βœ… Output: a clean, encoded, scaled dataset ready for modeling.


πŸ–ΌοΈ Visualization Gallery

Replace the placeholders below with screenshots from your notebook (save them in an assets/ folder).

πŸ“Š Histogram πŸ“¦ Boxplot πŸ”₯ Heatmap
hist box heat

πŸŽ₯ Demo: add your screen recording link here ➜ [Watch Walkthrough](https://your-video-link)


πŸ”„ Before vs After

Metric πŸ”΄ Raw Data 🟒 Cleaned Data
Missing values x 0
Duplicate rows x 0
Outliers flagged x handled
Data types inconsistent fixed
ML-ready ❌ βœ…

πŸ“‚ Repository Structure

πŸ“¦ eda-data-cleaning-preprocessing
 ┣ πŸ“‚ data
 ┃ ┣ πŸ“œ dataset.csv
 ┃ β”— πŸ“œ cleaned_dataset.csv
 ┣ πŸ“‚ notebooks
 ┃ β”— πŸ““ EDA_and_Preprocessing.ipynb
 ┣ πŸ“‚ assets
 ┃ ┣ πŸ–ΌοΈ histogram.png
 ┃ ┣ πŸ–ΌοΈ boxplot.png
 ┃ β”— πŸ–ΌοΈ heatmap.png
 ┣ πŸ“œ requirements.txt
 β”— πŸ“œ README.md

πŸ› οΈ Getting Started

# 1️⃣ Clone the repository
git clone https://github.com/<your-username>/<your-repo>.git
cd <your-repo>

# 2️⃣ (Optional) Create a virtual environment
python -m venv venv
source venv/bin/activate        # Windows: venv\Scripts\activate

# 3️⃣ Install dependencies
pip install -r requirements.txt

# 4️⃣ Launch Jupyter
jupyter notebook

requirements.txt

pandas
numpy
matplotlib
seaborn
scikit-learn
jupyter

πŸ’‘ Key Takeaways

  • 🧹 Clean data > fancy models. Most ML problems start as data problems.
  • πŸ‘€ Visualize early. Plots reveal what summary statistics hide.
  • πŸ§ͺ Document every decision. Why you imputed, capped, or dropped matters.
  • πŸ” EDA is iterative. You'll revisit earlier steps as you learn more.

πŸš€ Future Improvements

  • Automated profiling with ydata-profiling
  • Interactive plots with Plotly
  • Feature engineering & selection
  • Baseline ML model on the cleaned data
  • Streamlit dashboard for live exploration

Connect

LinkedIn GitHub

⭐ If this project helped you, drop a star! ⭐

#DataAnalytics #DataScience #EDA #DataCleaning #Python #Pandas #Seaborn #Matplotlib #MachineLearning

About

πŸ“Š Exploratory Data Analysis (EDA), Data Cleaning & Preprocessing in Action πŸš€ In this project walkthrough, I worked through a complete data preprocessing and EDA workflow using Python, Pandas, Matplotlib, and Seaborn. πŸ” The process included: βœ… Loading and inspecting the dataset βœ… Understanding data structure, dimensions, and data

Resources

Stars

3 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages