End-to-end EDA project on a real-world Cars dataset | Data cleaning, filtering & transformation using Python, Pandas, Matplotlib & Seaborn including fillna, isin, apply & value_counts for exploratory data analysis
A structured EDA project on a real-world Cars dataset, completed as part of the Python for Data Analysis course.
A structured EDA project on a real-world Cars dataset, completed as part of the Python for Data Analysis course.
Practice core Pandas operations — data cleaning, filtering, and transformation — while building a complete exploratory data analysis (EDA) with visualizations and actionable insights.
Explore and understand the dataset through statistical summaries and visual analysis, covering data structure, distributions, relationships, and key patterns.
- Source: CarsData.csv
- Records: 432 vehicles
- Features: Make, Model, Type, Origin, DriveTrain, MSRP, Invoice, EngineSize, Cylinders, Horsepower, MPG_City, MPG_Highway, Weight, Wheelbase, Length
| Library | Purpose |
|---|---|
| Pandas | Data cleaning, filtering, transformation |
| Matplotlib | Base plotting |
| Seaborn | Statistical visualizations |
| Command | Purpose |
|---|---|
pd.read_csv() |
Load CSV file into a DataFrame |
head() |
Show first N rows (default 5) |
shape |
Show total rows and columns |
isnull().sum() |
Detect missing values per column |
fillna() |
Fill null values with a specified value or mean |
value_counts() |
Count occurrences of each unique value |
isin() |
Filter rows matching values in a list |
apply() |
Apply a custom function along a column or row |
Find all null values in the dataset. Fill numerical nulls with the column mean, and categorical nulls with the column mode.
Check all unique Makes in the dataset and the count of each occurrence.
Use isin() to filter only Asian and European cars.
Drop all records where the car's weight exceeds 4000 using the ~ (NOT) operator.
Use apply() with a lambda function to add 3 to every value in the MPG_City column.
- Imports & Setup
- Load Dataset
- First Look (head / tail)
- Data Structure & Info
- Descriptive Statistics
- Categorical Exploration
- Analytical Questions (Q1 → Q5)
- Visualizations
- Univariate (Numerical + Categorical)
- Bivariate (Num vs Num · Num vs Cat · Cat vs Cat)
- Multivariate
- Correlation Heatmap · Pairplot
- Key Insights
After analyzing 432 car records across 15 features:
-
Heavier cars have significantly more horsepower
There is a strong positive correlation between Weight and Horsepower — confirmed by both the scatter plot and the correlation heatmap. -
More horsepower = lower fuel efficiency
MPG_City has a clear negative correlation with Horsepower and EngineSize — high-performance cars consume more fuel in city driving. -
Asian cars are the most fuel-efficient
The barplot of MPG_City by Origin shows Asian cars lead in city fuel efficiency, followed by European cars, with USA cars trailing behind. -
Sports cars dominate in horsepower, Trucks in weight
The boxplot of Horsepower by Type reveals Sports cars have the highest median horsepower, while Trucks are the heaviest category. -
USA dominates SUV and Truck segments
The categorical countplot shows that most SUVs and Trucks in the dataset originate from the USA, while Asia leads in Sedans. -
Over 20% of records had Weight > 4000
Before filtering, a substantial portion of records exceeded the 4000 weight threshold — mostly Trucks and large SUVs from USA manufacturers.
git clone https://github.com/ammarelsayed-2a/Project-4-Python-For-Data-Analysis-Cars.git
cd Project-4-Python-For-Data-Analysis-Cars
jupyter notebook "Project 4 Cars.ipynb"Ammar Elsayed — Python for Data Analysis | 2026
LinkedIn