In [2]: # Project: Electric Vehicle (EV) Adoption Analysis – India (2023)
import pandas as pd
In [3]: # Loading the CSV file, i.e. the dataset on which we have to perfrom the ana
df = pd.read_csv('India_EV_Sales_2023.csv')
[Link]()
Out[3]: Year Month EV_Category Units_Sold Market_Share State Growth
0 2023 January 2W 53972 47.92% Maharashtra 2
1 2023 February 2W 63275 10.55% Maharashtra 1
2 2023 March 2W 62116 58.57% Maharashtra 2
3 2023 April 2W 89269 44.51% Maharashtra 1
4 2023 May 2W 14573 63.19% Maharashtra 4
In [8]: # Task 1: Visualize the increase in EV sales by region (State)
import [Link] as plt
import seaborn as sns
# Group data by State and sum Units_Sold
state_sales = [Link]('State')['Units_Sold'].sum().sort_values(ascending=
# Bar Plot
[Link](figsize=(12, 6))
[Link](x=state_sales.index, y=state_sales.values, hue=state_sales.index
[Link](rotation=45)
[Link]('Total EV Sales by State (2023)')
[Link]('Units Sold')
[Link]('State')
plt.tight_layout()
[Link]()
In [16]: # Task 2: Compare EV sales with traditional vehicle sales
import pandas as pd
import [Link] as plt
# Load the EV sales dataset
ev_df = pd.read_csv('India_EV_Sales_2023.csv')
# Load the traditional vehicle sales dataset
traditional_df = pd.read_csv('Traditional_Vehicle_Sales.csv')
# Ensure the 'Month' and 'State' columns match for merging
ev_df['Month'] = ev_df['Month'].[Link]() # Capitalize months for co
traditional_df['Month'] = traditional_df['Month'].[Link]()
# Merge the two datasets on 'State' and 'Month'
merged_df = [Link](ev_df, traditional_df, on=['State', 'Month'], how='inne
# Compare EV sales vs Traditional vehicle sales (monthly comparison)
merged_df['Units_Sold_Traditional'] = merged_df['Units Sold (Traditional)']
merged_df['Units_Sold_EV'] = merged_df['Units_Sold']
# Summing sales per month
monthly_sales_comparison = merged_df.groupby('Month')[['Units_Sold_EV', 'Uni
# Plot the comparison as a bar chart
monthly_sales_comparison.plot(kind='bar', figsize=(12, 6))
[Link]('Monthly EV Sales vs Traditional Vehicle Sales (2023)')
[Link]('Units Sold')
[Link]('Month')
[Link](rotation=45)
plt.tight_layout()
# Display the plot
[Link]()
In [18]: # Task 3: Identify trends based on government incentives or infrastructure
import pandas as pd
import [Link] as plt
import seaborn as sns
# Load the dataset
df = pd.read_csv('Consumer_Adoption.csv')
# Display the first few rows of the dataset to understand its structure
print([Link]())
# Check for any missing values and handle them
print([Link]().sum())
df = [Link]() # Dropping rows with missing data, or you could fillna() b
# Convert columns like 'Govt Incentive Amount' and 'EV Units Sold' to numeri
df['Govt Incentive Amount'] = df['Govt Incentive Amount'].[Link](' INR'
df['EV Units Sold'] = df['EV Units Sold'].astype(int)
# Calculate correlation between government incentive and EV sales to see the
correlation = df['Govt Incentive Amount'].corr(df['EV Units Sold'])
print(f"Correlation between Government Incentives and EV Sales: {correlation
# Visualize the trend: Plotting EV sales vs. government incentive amount
[Link](figsize=(10, 6))
[Link](x='Govt Incentive Amount', y='EV Units Sold', data=df)
[Link]('EV Units Sold vs. Govt Incentive Amount')
[Link]('Government Incentive Amount (INR)')
[Link]('EV Units Sold')
[Link]()
# Analyze trends based on Charging Stations and Speed
charging_trend = [Link]('Charging Speed')['EV Units Sold'].mean().reset_
# Plot the trend of EV units sold by charging speed
[Link](figsize=(10, 6))
[Link](x='Charging Speed', y='EV Units Sold', data=charging_trend)
[Link]('EV Units Sold by Charging Speed')
[Link]('Charging Speed Type')
[Link]('Average EV Units Sold')
[Link]()
# Trend analysis based on Charging Stations available
charging_station_trend = [Link]('Charging Stations')['EV Units Sold'].me
# Plot the trend of EV units sold by the number of charging stations
[Link](figsize=(10, 6))
[Link](x='Charging Stations', y='EV Units Sold', data=charging_station
[Link]('EV Units Sold vs. Number of Charging Stations')
[Link]('Number of Charging Stations')
[Link]('Average EV Units Sold')
[Link]()
State Month EV Units Sold Govt Incentive Amount \
0 Tamil Nadu January 53972 50000 INR
1 Karnataka February 63275 60000 INR
2 Gujarat March 62116 40000 INR
3 Maharashtra April 89269 70000 INR
4 West Bengal May 14573 45000 INR
Charging Stations Charging Speed Total Vehicle Sales EV Market Share
0 150 Fast Charging 350000 15%
1 120 Regular Charging 280000 22%
2 100 Fast Charging 320000 19%
3 200 Fast Charging 450000 25%
4 80 Regular Charging 240000 6%
State 0
Month 0
EV Units Sold 0
Govt Incentive Amount 0
Charging Stations 0
Charging Speed 0
Total Vehicle Sales 0
EV Market Share 0
dtype: int64
Correlation between Government Incentives and EV Sales: 0.668730081030836
This notebook was converted with [Link]