├── Project.py ├── README.md └── python dataset.csv /Project.py: -------------------------------------------------------------------------------- 1 | import pandas as pd 2 | import numpy as np 3 | import seaborn as sns 4 | import matplotlib.pyplot as plt 5 | import scipy.stats as st 6 | df = pd.read_csv("C:\\Users\\Arab Singh\\Downloads\\python dataset.csv") 7 | 8 | # Objective. 1 - EV Adoption Trends by Year and Make 9 | 10 | ev_counts = df.groupby(['Model Year', 'Make']).size().reset_index(name='Count') 11 | top_makes = df['Make'].value_counts().nlargest(5).index 12 | filtered_ev_counts = ev_counts[ev_counts['Make'].isin(top_makes)] 13 | 14 | print("EV Registration Trends for Top 5 Makes by Year:") 15 | print(filtered_ev_counts.sort_values(by=['Model Year', 'Make'])) 16 | 17 | # Obj. 2 - Electric Range Distribution 18 | 19 | range_stats = df['Electric Range'].describe() 20 | print("Electric Range Summary:") 21 | print(range_stats) 22 | 23 | # Detect potential outliers 24 | outliers = df[df['Electric Range'] > 350] 25 | print("\nEVs with unusually high electric range (>350 miles):") 26 | print(outliers[['Make', 'Model', 'Electric Range']]) 27 | 28 | # Obj. 3 - MSRP Comparison Across Vehicle Types 29 | 30 | msrp_stats = df.groupby('Electric Vehicle Type')['Base MSRP'].describe() 31 | print("MSRP Statistics by Vehicle Type:") 32 | print(msrp_stats) 33 | 34 | # Obj. 4 - Correlation Between Numerical Features 35 | 36 | numerical_df = df.select_dtypes(include=['int64', 'float64']) 37 | correlation_matrix = numerical_df.corr() 38 | 39 | print("Correlation Matrix for Numeric Features:") 40 | print(correlation_matrix) 41 | 42 | # Obj. 5 - Electric Vehicle Type Distribution 43 | 44 | vehicle_type_counts = df['Electric Vehicle Type'].value_counts() 45 | vehicle_type_percent = df['Electric Vehicle Type'].value_counts(normalize=True) * 100 46 | 47 | print("Electric Vehicle Type Distribution (Count and Percentage):") 48 | print(pd.DataFrame({'Count': vehicle_type_counts, 'Percentage': vehicle_type_percent.round(2)})) 49 | 50 | plt.figure(figsize=(10, 6)) 51 | sns.histplot(df['Electric Range'].dropna(), bins=30, kde=True, color='skyblue') 52 | plt.title("Histogram: Electric Range") 53 | plt.xlabel("Electric Range (miles)") 54 | plt.ylabel("Frequency") 55 | plt.tight_layout() 56 | plt.show() 57 | 58 | top_makes_count = df['Make'].value_counts().nlargest(10) 59 | plt.figure(figsize=(10, 6)) 60 | sns.barplot(x=top_makes_count.values, y=top_makes_count.index, palette="magma") 61 | plt.title("Barplot: Top 10 EV Makes") 62 | plt.xlabel("Count") 63 | plt.ylabel("Make") 64 | plt.tight_layout() 65 | plt.show() 66 | 67 | plt.figure(figsize=(10, 6)) 68 | sns.boxplot(data=df, x='Electric Vehicle Type', y='Base MSRP') 69 | plt.title("Boxplot: MSRP by Vehicle Type") 70 | plt.xlabel("Vehicle Type") 71 | plt.ylabel("Base MSRP ($)") 72 | plt.xticks(rotation=15) 73 | plt.tight_layout() 74 | plt.show() 75 | 76 | plt.figure(figsize=(10, 6)) 77 | numerical_df = df.select_dtypes(include=['int64', 'float64']) 78 | correlation = numerical_df.corr() 79 | sns.heatmap(correlation, annot=True, cmap="coolwarm", fmt=".2f") 80 | plt.title("Correlation Heatmap") 81 | plt.tight_layout() 82 | plt.show() 83 | 84 | ev_type_counts = df['Electric Vehicle Type'].value_counts() 85 | plt.figure(figsize=(8, 8)) 86 | plt.pie(ev_type_counts, labels=ev_type_counts.index, autopct='%1.1f%%', startangle=140, colors=sns.color_palette('pastel')) 87 | plt.title("Pie Chart: Electric Vehicle Type Distribution") 88 | plt.tight_layout() 89 | plt.show() -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Electric-Vehicle-Market-Analysis-using-Python 2 | 3 | → This project is a comprehensive data analytics case study on electric vehicles, completed as part of my Data Analytics using Python coursework. 4 | 5 | 📁 Project Name: ev-data-analysis-python 6 | 7 | 🚀 Project Overview 8 | This Python project analyzes a large real-world dataset of electric vehicles to uncover insights about EV trends, pricing, range, and environmental eligibility. 9 | 10 | 📌 Key Objectives: 11 | • Track EV adoption by year and make 12 | 13 | • Analyze electric range distribution 14 | 15 | • Compare MSRP across vehicle types (BEV vs. PHEV) 16 | 17 | • Visualize correlation between features 18 | 19 | • Examine CAFV (Clean Alternative Fuel Vehicle) eligibility 20 | 21 | 🛠 Tools & Libraries: 22 | • Python (Pandas, Matplotlib, Seaborn) 23 | 24 | • Jupyter Notebook 25 | 26 | • Data Cleaning & EDA 27 | 28 | • Statistical summaries and visualization 29 | 30 | 📈 Outcome: 31 | This project enhanced my skills in data preprocessing, exploratory analysis, and storytelling with data. It also deepened my understanding of the growing EV landscape and how data science can contribute to a sustainable future. 32 | 33 | 🔖 Tags #DataScience #ElectricVehicles #ElectricVehicleTrends #Python #Pandas #Seaborn #StudentProject #EDA#ShelterAnalytics #DataVisualization #RealWorldData 34 | --------------------------------------------------------------------------------