0% found this document useful (0 votes)
4 views4 pages

R Prerequisite1

The document outlines the process of importing libraries and reading a housing dataset using Python's pandas library. It includes details on the dataset structure, such as the number of entries and columns, and provides a summary of the dataset's statistics. Additionally, it demonstrates a simple data visualization using matplotlib to create a histogram of random data.

Uploaded by

fijajamage9503
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views4 pages

R Prerequisite1

The document outlines the process of importing libraries and reading a housing dataset using Python's pandas library. It includes details on the dataset structure, such as the number of entries and columns, and provides a summary of the dataset's statistics. Additionally, it demonstrates a simple data visualization using matplotlib to create a histogram of random data.

Uploaded by

fijajamage9503
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Name:Rajlaxmi Kasture Class:SYMCA

Rollno:A-238 Sub-Incharge:Prof.dr.Kapil Misal


Prerequisite no.1

Importing Required Libraries and Reading Dataset


import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
data=pd.read_csv('/content/Housing.csv')
print(data.head())
Output:
price area bedrooms bathrooms stories mainroad guestroom basement \
0 13300000 7420 4 2 3 yes no no
1 12250000 8960 4 4 4 yes no no
2 12250000 9960 3 2 2 yes no yes
3 12215000 7500 4 2 2 yes no yes
4 11410000 7420 4 1 2 yes yes yes

hotwaterheating airconditioning parking prefarea furnishingstatus


0 no yes 2 yes furnished
1 no yes 3 no furnished
2 no no 2 yes semi-furnished
3 no yes 3 yes furnished
4 no yes 2 no furnished

data.shape
(545, 13)
data.info()
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 545 entries, 0 to 544
Data columns (total 13 columns):
# Column Non-Null Count Dtype
Name:Rajlaxmi Kasture Class:SYMCA
Rollno:A-238 Sub-Incharge:Prof.dr.Kapil Misal
Prerequisite no.1
--- ------ -------------- -----
0 price 545 non-null int64
1 area 545 non-null int64
2 bedrooms 545 non-null int64
3 bathrooms 545 non-null int64
4 stories 545 non-null int64
5 mainroad 545 non-null object
6 guestroom 545 non-null object
7 basement 545 non-null object
8 hotwaterheating 545 non-null object
9 airconditioning 545 non-null object
10 parking 545 non-null int64
11 prefarea 545 non-null object
12 furnishingstatus 545 non-null object
dtypes: int64(6), object(7)
memory usage: 55.5+ KB
data.describe()

price area bedrooms bathrooms stories parking

coun 5.450000e+0 545.00000 545.00000 545.00000 545.00000


545.000000
t 2 0 0 0 0

mea 4.766729e+0
5150.541284 2.965138 1.286239 1.805505 0.693578
n 6

1.870440e+0
std 2170.141023 0.738064 0.502470 0.867492 0.861586
6

1.750000e+0
min 1650.000000 1.000000 1.000000 1.000000 0.000000
6
Name:Rajlaxmi Kasture Class:SYMCA
Rollno:A-238 Sub-Incharge:Prof.dr.Kapil Misal
Prerequisite no.1
3.430000e+0
25% 3600.000000 2.000000 1.000000 1.000000 0.000000
6

4.340000e+0
50% 4600.000000 3.000000 1.000000 2.000000 0.000000
6

5.740000e+0
75% 6360.000000 3.000000 2.000000 2.000000 1.000000
6

1.330000e+0 16200.00000
max 6.000000 4.000000 4.000000 3.000000
7 0

data.columns.to_list()
['price',
'area',
'bedrooms',
'bathrooms',
'stories',
'mainroad',
'guestroom',
'basement',
'hotwaterheating',
'airconditioning',
'parking',
'prefarea',
'furnishingstatus']
Data Visualization using matplotlib
data=np.random.randn(40)
plt.hist(data,bins=20)
plt.xlabel('value')
plt.ylabel('Frequency')
plt.title('Histogram Of Random Data')
plt.show()
Name:Rajlaxmi Kasture Class:SYMCA
Rollno:A-238 Sub-Incharge:Prof.dr.Kapil Misal
Prerequisite no.1

You might also like