- Project Overview
- Dataset
- Research Questions
- Workflow
- Key Findings
- SQL Analysis
- How to Reproduce
- Next Steps
- Repository Structure
- Authors
- Source
This project explores the Auto MPG dataset to understand how car origin influences vehicle characteristics and how those characteristics evolved between 1970 and 1982.
The analysis focuses on fuel efficiency, engine configuration, horsepower, vehicle weight, displacement, acceleration, model year, and origin.
The dataset is available from the UCI Machine Learning Repository and was also accessed through KaggleHub during the notebook workflow.
The dataset is not included in this repository. To reproduce the analysis, please download it directly from the original public source listed in the Source section.
The original dataset contains:
- 398 rows
- 9 columns
mpg: Miles per gallon / fuel efficiencycylinders: Number of engine cylindersdisplacement: Engine displacementhorsepower: Engine horsepowerweight: Vehicle weightacceleration: Acceleration timemodel_year: Model yearorigin: Car origincar_name: Car model name
- The dataset contained 6 missing values in
horsepower, originally stored as non-numeric values. - The
horsepowercolumn was converted from object type to numeric. - Missing horsepower values were handled through targeted analysis (imputation) of similar car models.
- A small number of rows was dropped only when no reliable estimate could be made.
- No duplicated rows were identified.
This project was guided by two main questions:
- How does car origin relate to vehicle characteristics?
- How does car origin influence the evolution of those characteristics over time?
The main comparison was between cars from:
- USA
- Europe
- Japan
The cleaning process included:
- Loading the Auto MPG dataset
- Standardising column names
- Checking data types
- Checking for missing values and duplicates
- Investigating hidden missing values in
horsepower - Converting
horsepowerto numeric - Handling missing horsepower values
- Reviewing outliers using the IQR method
The EDA was structured into three parts:
- Univariate analysis: understanding individual variable distributions
- Bivariate analysis: comparing origin against vehicle characteristics such as:
-
cylindersmpghorsepowerweightdisplacementaccelerationmodel_year
- Multivariate analysis: analysing how characteristics evolved over time by origin
The analysis used:
- Frequency tables
- Histograms
- Box plots
- Violin plots
- Line plots
- Grouped summary tables
Main libraries used:
pandasnumpyseabornmatplotlib
- The dataset is dominated by USA cars, followed by Japan and Europe.
- Most cars in the dataset have 4-cylinder engines.
- USA cars tend to have:
- lower MPG
- higher horsepower
- higher weight
- larger displacement
- greater variability
- Japanese cars tend to be the most fuel-efficient.
- European cars generally sit between USA and Japan, but closer to Japan in efficiency.
- Fuel efficiency improved over time across all origins.
- USA cars showed a clear reduction in horsepower, weight, and displacement over time.
- The results suggest a strong trade-off between power, weight, displacement, and fuel efficiency.
- Vehicle characteristics should not be interpreted independently; they form a coherent system related to vehicle design.
A SQL extension was added to translate EDA insights into targeted queries.
The SQL analysis explores:
- Most common car models by origin
- Most fuel-efficient cars
- Relationship between horsepower and MPG
- Average MPG by model year
- Differences between high-MPG and low-MPG cars
- Power-to-weight ratio by origin
- Power-to-weight ratio and acceleration
- Acceleration trends over time
- MPG and horsepower among 4-cylinder cars
- Displacement and horsepower by cylinder count
See queries.sql for the full SQL implementation. You can run those queries in any SQL environment after loading the dataset into a compatible database.
- Python 3.x
- Jupyter Notebook
pandas
numpy
seaborn
matplotlib
kagglehub- Clone this repository.
- Open the project folder.
- Install the required libraries.
- Launch Jupyter Notebook.
- Open
main.ipynb. - Run the notebook cells in order.
- Open
queries.sqlto review or execute the SQL queries.
Possible future improvements include:
- Analyse power-to-weight ratio by origin.
- Study how power-to-weight ratio changed over time.
- Quantify yearly improvements in fuel efficiency.
- Investigate how long Japanese cars remained more fuel-efficient than European cars.
- Apply statistical testing to validate observed trends.
- Extend the project with predictive modelling for MPG.
├── main.ipynb # Main notebook with data cleaning and EDA
├── queries.sql # SQL queries based on EDA insights
├── EDA Auto-MPG.pdf # Final presentation
├── README.md # Project documentation
- Bruno Gregório — GitHub Profile
- Vítor Ferraz — GitHub Profile
-
Auto MPG dataset: UCI Machine Learning Repository
-
NOTE: If you use this dataset, please credit the original dataset providers and cite the source appropriately.