0% found this document useful (0 votes)
6 views7 pages

10 TH

Wed technology assignment
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)
6 views7 pages

10 TH

Wed technology assignment
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/ 7

In [2]: import numpy as np

import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns

In [3]: data = pd.read_csv('https://gist.githubusercontent.com/curran/a08a1080b88344b0


data

Out[3]: sepal_length sepal_width petal_length petal_width species

0 5.1 3.5 1.4 0.2 setosa

1 4.9 3.0 1.4 0.2 setosa

2 4.7 3.2 1.3 0.2 setosa

3 4.6 3.1 1.5 0.2 setosa

4 5.0 3.6 1.4 0.2 setosa

... ... ... ... ... ...

145 6.7 3.0 5.2 2.3 virginica

146 6.3 2.5 5.0 1.9 virginica

147 6.5 3.0 5.2 2.0 virginica

148 6.2 3.4 5.4 2.3 virginica

149 5.9 3.0 5.1 1.8 virginica

150 rows × 5 columns

In [4]: data.head()

Out[4]: sepal_length sepal_width petal_length petal_width species

0 5.1 3.5 1.4 0.2 setosa

1 4.9 3.0 1.4 0.2 setosa

2 4.7 3.2 1.3 0.2 setosa

3 4.6 3.1 1.5 0.2 setosa

4 5.0 3.6 1.4 0.2 setosa


In [5]: data.describe()

Out[5]: sepal_length sepal_width petal_length petal_width

count 150.000000 150.000000 150.000000 150.000000

mean 5.843333 3.054000 3.758667 1.198667

std 0.828066 0.433594 1.764420 0.763161

min 4.300000 2.000000 1.000000 0.100000

25% 5.100000 2.800000 1.600000 0.300000

50% 5.800000 3.000000 4.350000 1.300000

75% 6.400000 3.300000 5.100000 1.800000

max 7.900000 4.400000 6.900000 2.500000

In [6]: data.describe(include = 'object')

Out[6]: species

count 150

unique 3

top setosa

freq 50

In [7]: data.isnull().sum()

Out[7]: sepal_length 0
sepal_width 0
petal_length 0
petal_width 0
species 0
dtype: int64

In [8]: print("\n\nThe features in the dataset are as follows : ")


print("1. Sepal length : ", data['sepal_length'].dtype)
print("2. Sepal width : ", data['sepal_width'].dtype)
print("3. Petal length : ", data['petal_length'].dtype)
print("4. Petal width : ", data['petal_width'].dtype)
print("5. Species : ", data['species'].dtype)

The features in the dataset are as follows :


1. Sepal length : float64
2. Sepal width : float64
3. Petal length : float64
4. Petal width : float64
5. Species : object
In [9]: sns.histplot(x = data['sepal_length'], kde=True)

Out[9]: <matplotlib.axes._subplots.AxesSubplot at 0x7fe839f4d9d0>

In [10]: sns.histplot(x = data['sepal_width'], kde=True)

Out[10]: <matplotlib.axes._subplots.AxesSubplot at 0x7fe839343e90>


In [11]: sns.histplot(x = data['petal_length'], kde=True)

Out[11]: <matplotlib.axes._subplots.AxesSubplot at 0x7fe836d341d0>

In [12]: sns.histplot(x = data['petal_width'], kde=True)

Out[12]: <matplotlib.axes._subplots.AxesSubplot at 0x7fe836c64f50>


In [13]: sns.boxplot(data['sepal_length'])

/usr/local/lib/python3.7/dist-packages/seaborn/_decorators.py:43: FutureWarn
ing: Pass the following variable as a keyword arg: x. From version 0.12, the
only valid positional argument will be `data`, and passing other arguments w
ithout an explicit keyword will result in an error or misinterpretation.
FutureWarning

Out[13]: <matplotlib.axes._subplots.AxesSubplot at 0x7fe836b8a8d0>

In [14]: sns.boxplot(data['sepal_width'])

/usr/local/lib/python3.7/dist-packages/seaborn/_decorators.py:43: FutureWarn
ing: Pass the following variable as a keyword arg: x. From version 0.12, the
only valid positional argument will be `data`, and passing other arguments w
ithout an explicit keyword will result in an error or misinterpretation.
FutureWarning

Out[14]: <matplotlib.axes._subplots.AxesSubplot at 0x7fe836c79ed0>


In [15]: sns.boxplot(data['petal_length'])

/usr/local/lib/python3.7/dist-packages/seaborn/_decorators.py:43: FutureWarn
ing: Pass the following variable as a keyword arg: x. From version 0.12, the
only valid positional argument will be `data`, and passing other arguments w
ithout an explicit keyword will result in an error or misinterpretation.
FutureWarning

Out[15]: <matplotlib.axes._subplots.AxesSubplot at 0x7fe836bf8290>

In [16]: sns.boxplot(data['petal_width'])

/usr/local/lib/python3.7/dist-packages/seaborn/_decorators.py:43: FutureWarn
ing: Pass the following variable as a keyword arg: x. From version 0.12, the
only valid positional argument will be `data`, and passing other arguments w
ithout an explicit keyword will result in an error or misinterpretation.
FutureWarning

Out[16]: <matplotlib.axes._subplots.AxesSubplot at 0x7fe836a5f850>


In [17]: sns.boxplot(x='sepal_length',y='species',data=data)

Out[17]: <matplotlib.axes._subplots.AxesSubplot at 0x7fe836a3ca90>

In [18]: sns.boxplot(x='petal_length',y='species',data=data)

Out[18]: <matplotlib.axes._subplots.AxesSubplot at 0x7fe83696b950>

You might also like