This project aims to analyze historical sales data of Electric Vehicles (EVs) and Plug-in Hybrid Electric Vehicles (PHEVs) to predict future sales trends. The analysis provides insights into growth patterns, market dynamics, and infrastructure needs, aiding a dealership in strategic planning and investment decisions.
The study utilizes data from the following sources:
- US Department of Energy
- Local DMVs of California, Florida, New York, Texas, and Washington
- U.S. Census Bureau
- U.S. Energy Information Administration
- Bureau of Labor Statistics
- The World Data Bank
Cleaning and wrangling the data involved:
- Focusing on a 10-year period for state-specific data
- Using recent data for U.S. general data
- Ensuring data was cleaned and processed for predictive analysis
- Machine Learning Predictive Analysis.ipynb
- States Notebook.ipynb
-
Data Loading and Preparation
- Loading the dataset
- Converting 'Date' column to datetime format
- Setting the date column as the index
- Cleaning 'Gas Vehicles sales' column
-
Data Visualization
- Visualizing trends for Hybrid/EV sales, gas vehicle sales, gas prices, diesel prices, unemployment rate, and inflation rate
-
Correlation Analysis
- Calculating and displaying the correlation matrix
-
Feature Engineering and Normalization
- Adding polynomial features
- Normalizing the data
-
Model Training and Tuning
- Defining models (Random Forest, Gradient Boosting)
- Hyperparameter tuning using GridSearchCV
-
Ensemble Modeling
- Creating and evaluating an ensemble model combining the best-tuned models
-
Feature Importance and Predictions
- Visualizing model predictions vs. actual values
- Plotting feature importances for both Random Forest and Gradient Boosting models
-
Data Loading
- Importing state-specific data from various sources
-
Data Cleaning and Processing
- Cleaning and wrangling state-specific data for analysis
-
Exploratory Data Analysis (EDA)
- Visualizing state-specific trends and patterns
-
Model Development
- Developing and tuning models for state-specific predictive analysis
-
Model Evaluation
- Evaluating model performance using appropriate metrics
The predictive analysis indicates a strong growth trajectory for EV/PHEV sales, with estimates between 200,000 and 500,000 units. For the dealership, this suggests a significant opportunity to expand EV/PHEV inventory and enhance charging infrastructure. By leveraging these predictions, the dealership can capitalize on market trends, ensuring long-term growth and leadership in the EV market.
- pandas
- matplotlib
- seaborn
- scikit-learn
- xgboost
- catboost
- statsmodels
Install the dependencies using pip:
pip install pandas matplotlib seaborn scikit-learn xgboost catboost statsmodelsGian F. Villafañe Morales - Data Analyst