0% found this document useful (0 votes)
9 views3 pages

Vsec PW 7

Bar charts in Data science
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)
9 views3 pages

Vsec PW 7

Bar charts in Data science
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/ 3

Assignment No.

In [1]: Name:Wavhal Prathmesh Navnath Class:SY-B Roll No:2317137 Batch:D

In [42]: import pandas as pd

In [43]: import numpy as np

In [44]: import seaborn as sns

In [45]: import matplotlib.pyplot as plt

In [46]: iris=sns.load_dataset("iris")

In [47]: iris.head()

Out[47]: 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 [48]: iris['species'].value_counts()

Out[48]: species
setosa 50
versicolor 50
virginica 50
Name: count, dtype: int64

In [49]: speciescount=iris['species'].value_counts()

In [50]: plt.figure(figsize=(8,8))
plt.pie(speciescount,labels=speciescount.index)
plt.title('Disribution of Iris Species')
plt.show()
In [51]: species_means=iris.groupby('species').mean()

In [52]: species_means.plot(kind='bar',figsize=(10,6))
plt.title("Average Measurement of iris species")
plt.xlabel('species')
plt.ylabel("Measurement (cm)")
plt.xticks(rotation=0)
plt.legend(title='Features')
plt.show()
----
Average Measurement of iris species
Features
sepal_length
6
sepal_width
peta l_le11gth
petal_width
5

o ---
setosa versicolor virginica
species

You might also like