├── README.md └── python project.py /README.md: -------------------------------------------------------------------------------- 1 | # Project-Python -------------------------------------------------------------------------------- /python project.py: -------------------------------------------------------------------------------- 1 | import pandas as pd 2 | import matplotlib.pyplot as plt 3 | import seaborn as sns 4 | 5 | # Set Seaborn style 6 | sns.set(style="whitegrid") 7 | 8 | # Load the dataset 9 | file_path = r"C:\Users\tanmay\Downloads\Electric_Vehicle_Data.xlsx" 10 | df = pd.read_excel(file_path) 11 | 12 | # Display the first few rows of the dataset 13 | print("Dataset Preview:") 14 | print(df.head()) 15 | 16 | # Objective 1: Most Popular EV Makes 17 | print("\nTop 10 EV Makes:") 18 | top_makes = df['Make'].value_counts().head(10) 19 | print(top_makes) 20 | plt.figure(figsize=(10, 6)) 21 | sns.barplot(x=top_makes.values, y=top_makes.index, hue=top_makes.index, palette='viridis', legend=False) 22 | plt.title('Top 10 Most Common EV Makes') 23 | plt.xlabel('Number of Vehicles') 24 | plt.ylabel('Vehicle Make') 25 | plt.tight_layout() 26 | plt.show() 27 | 28 | 29 | # Objective 2: Distribution of Model Years 30 | print("\nModel Year Distribution:") 31 | plt.figure(figsize=(10, 6)) 32 | sns.histplot(df['Model Year'].dropna(), bins=20, kde=True, color='skyblue') 33 | plt.title('Distribution of Electric Vehicle Model Years') 34 | plt.xlabel('Model Year') 35 | plt.ylabel('Count') 36 | plt.tight_layout() 37 | plt.show() 38 | 39 | 40 | # Objective 3: Top Cities for EV Adoption 41 | print("\nTop 10 Cities with Most EVs:") 42 | top_cities = df['City'].value_counts().head(10) 43 | print(top_cities) 44 | plt.figure(figsize=(10, 6)) 45 | sns.barplot(x=top_cities.values, y=top_cities.index, hue=top_cities.index, palette='coolwarm', legend=False) 46 | plt.title('Top 10 Cities by EV Registrations') 47 | plt.xlabel('Number of EVs') 48 | plt.ylabel('City') 49 | plt.tight_layout() 50 | plt.show() 51 | 52 | 53 | # Objective 4: Electric Range Analysis 54 | print("\nElectric Range Stats:") 55 | print(df['Electric Range'].describe()) 56 | plt.figure(figsize=(10, 6)) 57 | sns.boxplot(x=df['Electric Range'].dropna(), color='orange') 58 | plt.title('Electric Vehicle Range Distribution') 59 | plt.xlabel('Electric Range (Miles)') 60 | plt.tight_layout() 61 | plt.show() 62 | 63 | 64 | # Objective 5: EV Types by Fuel Type 65 | print("\nElectric Vehicle Type Counts:") 66 | fuel_counts = df['Electric Vehicle Type'].value_counts() 67 | print(fuel_counts) 68 | plt.figure(figsize=(8, 6)) 69 | sns.barplot(x=fuel_counts.index, y=fuel_counts.values, hue=fuel_counts.index, palette='pastel', legend=False) 70 | plt.title('Distribution of EV Types') 71 | plt.ylabel('Number of Vehicles') 72 | plt.xlabel('Electric Vehicle Type') 73 | plt.xticks(rotation=15) 74 | plt.tight_layout() 75 | plt.show() 76 | --------------------------------------------------------------------------------