ML_Assignment
ML_Assignment
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')
df.head()
# Bar Plot
plt.figure(figsize=(12, 6))
sns.barplot(x=state_sales.index, y=state_sales.values, hue=state_sales.index
plt.xticks(rotation=45)
plt.title('Total EV Sales by State (2023)')
plt.ylabel('Units Sold')
plt.xlabel('State')
plt.tight_layout()
plt.show()
In [16]: # Task 2: Compare EV sales with traditional vehicle sales
import pandas as pd
import matplotlib.pyplot as plt
# Display the first few rows of the dataset to understand its structure
print(df.head())
# Convert columns like 'Govt Incentive Amount' and 'EV Units Sold' to numeri
df['Govt Incentive Amount'] = df['Govt Incentive Amount'].str.replace(' INR'
df['EV Units Sold'] = df['EV Units Sold'].astype(int)