image_output_1.png
import matplotlib.pyplot as plt

import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)

import seaborn as sns

df = pd.read_csv('/kaggle/input/car-price-prediction/CarPrice_Assignment.csv')

df.describe().T

outliers = ['price']
plt.rcParams['figure.figsize'] = [8, 8]
df.shape

df = df.drop(['car_ID'], axis=1)

cat_col = df.select_dtypes(include=['object']).columns
num_col = df.select_dtypes(exclude=['object']).columns

df_v=pd.DataFrame(df['CarName'].value_counts()).reset_index().rename(columns={'index':'car_name','CarName': 'count'})
plot = sns.barplot(y='car_name',x='count',data=df_v)
plot=plt.setp(plot.get_xticklabels(), rotation=80)

ax = sns.pairplot(df[num_col])

df_v=pd.DataFrame(df['fueltype'].value_counts())
plot = df_v.plot.pie(y='fueltype', figsize=(5, 5))

f= plt.figure(figsize=(12,5))

ax=f.add_subplot(121)
sns.distplot(df[(df.fueltype== 'gas')]["price"],color='b',ax=ax)
ax.set_title('Distribution of price of gas vehicles')

ax=f.add_subplot(122)
sns.distplot(df[(df.fueltype == 'diesel')]['price'],color='r',ax=ax)
ax.set_title('Distribution of ages of diesel vehicles');

df_v = pd.DataFrame(df['aspiration'].value_counts())
plot = df_v.plot.pie(y='aspiration', figsize=(5, 5))