216122, 11:13. AM
import pandas
df = pd.read_csv('/content/drive/MyDrive/Colab Notebooks/car_data.csv')
as pd
Introduction ta Pythan- Minar - Dacembarpynt - Colaboratory
Year Selling Price Present_Price kms_Driven Fuel_Type Seller_tyt
3.35
475
7.25
2.85
4.60
9.50
4.00
3.35
11.50
5.30
3.35
75
225
85
60
BRN
9.5
4,00
3.35
11.50
5.30
df
car_Name
o ritz 2014
1 sx4 2013
2 ciaz 2017
3 wagonr 2011
4 swift 2014
296 city 2016
297 brio 2015
298 city 2009
299 city 2017
300 brio 2016
301 rows x 9 columns
df. info
df. shape
(3e1, 9)
5.59
9.54
9.85
4.15
687
11.60
5.90
11.00
12.50
5.90
Car_Name Year
Dealer
Dealer
Dealer
Dealer
Dealer
Dealer
Dealer
Dealer
Dealer
Dealer
27000
43000
6900
5200
42450
33988
60000
87934
9000
5464
Selling Price
Manual
Manual
Manual
Manual
Manual
Manual
Manual
Manual
Manual
Manual
Petrol
Diesel
Petrol
Petrol
Diesel
Diesel
Petrol
Petrol
Diesel
Petrol
Deal
Deal
Deal
Deal
Deal
Deal
Deal
Deal
Deal
Deal
Seller_Type
# From which manufacturing year to which manufacturing year vehicles are present in this c
hitps:icolab research google com/riveltJmmA-AlLLyxJWRWVD8Zaxx7zkruP ViscrolTo-tdNtS7o-1J68printMode=tue
4216122, 11:13. AM Introduction ta Pythan- Minar - Dacembarpynt - Colaboratory
column = df["Year"]
max_value = column.max()
print (max_value)
2018
column = df["Year"]
min_value = colunn.min()
print (min_value)
2003
# The vehicles were produced from year 2003 to year 218 in the given set of data.
# What is the lowest price to which a vehicle is sold ?
column = df['Selling Price']
min_value = column.min()
print (min_value)
e.2
# The minimium selling price to which a vehicle is sold was @.1
# What is the highest price to which a vehicle is sold?
column = d#['Selling Price']
max_value = column.max()
print(max_value)
35.8
# The maximum selling price to which a vehicle is sold was 35.0.
How many records are there?
df.shape
(301, 9)
i Are there any missing records in this data ?
hitpsficolab research. google.comicrivelJmmA-AlL Llyn WRWVDBZaxx7zkruPY#scroT
INISTo-1 J68prntMode=tue 25216122, 11:13. AM Introduction ta Pythan- Minar - Dacembarpynt - Colaboratory
df.isnull(). values. any()
False
# No, there isn't any null values in the given data.
# How many different vehicles are present in this data?
df.Car_Name.unique()
x = df.Car_Name.unique()
Jen(x)
98
# There are total 98 different vehicles present in the data set.
Does the database include any CNG vehicle ? If yes how many of them are there ?
df.groupby(‘Fuel_Type’, sort = False).size()
Fuel_type
Petrol 239
Diesel 60
NG 2
dtype: intea
# There are 2 CNG vehicles in the database.
# How many vehicles here are for sell from Individuals directly ?
df[‘Seller_type'].value_counts()
Dealer 195
Individual 106
Name: Seller_Type, dtype: intes
There are 106 vehicles that are sold from Individuals directly.
Does this database contain auto transmission vehicles ? If yes how many of them are there
df.groupby( ‘Transmission’, sort = False).size()
‘Transmission
Manual, 261
hitps:icolab research google com/riveltJmmA-AlLLyxJWRWVD8Zaxx7zkruP ViscrolTo-tdNtS7o-1J68printMode=tue 35216122, 11:13. AM Introduction to Pythan- Minor - December pynb - Colaboratory
Automatic 48
dtype: inte4
#There are 4@ auto transmission vehicles in the given data set.
#Plot a visual to show the number of vehicles manufactured after 2014(new vehicles)
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
df = pd.read_csv('/content/drive/MyDrive/Colab Notebooks/car_data.csv')
adf.groupby("Year', sort = False).size().plot(kind = "bar")
df.groupby(pd.cut(df['Year'], np.arange(2014,2019)), sort = False).size().plot(kind = “bar
plt.show()
»
° Bos 8 8
~ ear ~
hitps:icolab research google com/riveltJmmA-AlLLyxJWRWVD8Zaxx7zkruP ViscrolTo-tdNtS7o-1J68printMode=tue as216122, 11:13. AM Introduction ta Pythan- Minar - Dacembarpynt - Colaboratory
Y 0s completed at 11:12 AM
hitpsficolab research. google.comicrivelJmmA-AlL Llyn WRWVDBZaxx7zkruPY#scroT
INISTo-1 J68prntMode=tue
sis