4
4
df = pd.read_csv(url)
1
2) Create a distribution plot (kernel density estimation plot) to understand the distribution of
Price for different Cities
[3]: plt.figure(figsize=(12, 8))
sns.kdeplot(data=df, x="Price", hue="City", fill=True, palette="muted")
plt.title('Distribution of Price for Different Cities')
plt.xlabel('Price')
plt.ylabel('Density')
plt.show()
2
3) Create a relation plot to visualise how, along with the effect of Recession, GDP has changed
with time (Year)
3
4) Prepare a Joint Plot to understand the relation between Price, Advertising Expenditure and
Automobile Sales
[5]: sns.jointplot(data=df, x="Price", y="Advertising_Expenditure",␣
↪hue="Automobile_Sales", palette="viridis", kind="scatter")
plt.xlabel('Price')
plt.ylabel('Advertising Expenditure')
plt.show()
4
5) Create a heatmap to understand the correlation for GDP, Growth Rate, and Unemployment
Rate
[9]: # Create a heatmap for GDP, Growth Rate, and Unemployment (assuming actual␣
↪column names)
plt.figure(figsize=(10, 6))
correlation_data = df[['GDP', 'Growth_Rate', 'unemployment_rate']].dropna()
correlation_matrix = correlation_data.corr()
5
6) Make a swarm plot to deduce the automotive sales for every Automobile Type within every
calendar month
[12]: plt.figure(figsize=(16, 10))
sns.swarmplot(data=df, x="Month", y="Automobile_Sales", hue="Vehicle_Type",␣
↪palette="Set2", dodge=True)
plt.xlabel('Month')
plt.ylabel('Automobile_Sales')
plt.show()
6
7) Prepare a Violin Plot of how Consumer Confidence has changed with every progressing year
7
8) Create a facet grid of Competition to view the histogram of Advertising Expenditure
8
9