Professional Documents
Culture Documents
#Magapu Harsha #ADA Lab Slot (L47+L48) Pandas PD Numpy NP Matplotlib Pyplot PLT DF PD - Read - CSV DF
#Magapu Harsha #ADA Lab Slot (L47+L48) Pandas PD Numpy NP Matplotlib Pyplot PLT DF PD - Read - CSV DF
#Magapu Harsha #ADA Lab Slot (L47+L48) Pandas PD Numpy NP Matplotlib Pyplot PLT DF PD - Read - CSV DF
ipynb
19BCD7156
#Magapu Harsha
In [ ]: import pandas as pd
import numpy as np
import matplotlib pyplot plt
In [3]: df=pd.read_csv("iris.csv")
df
Out[3]:
Id SepalLengthCm SepalWidthCm PetalLengthCm PetalWidthCm Species
1 of 9 15-Mar-22, 4:19 PM
ADA_lab01 http://localhost:8888/notebooks/ADA_lab01.ipynb
2 of 9 15-Mar-22, 4:19 PM
ADA_lab01 http://localhost:8888/notebooks/ADA_lab01.ipynb
3 of 9 15-Mar-22, 4:19 PM
ADA_lab01 http://localhost:8888/notebooks/ADA_lab01.ipynb
0 Iris-setosa
1 Iris-setosa
2 Iris-setosa
3 Iris-setosa
4 Iris-setosa
5 Iris-setosa
6 Iris-setosa
7 Iris-setosa
8 Iris-setosa
9 Iris-setosa
10 Iris-setosa
11 Iris-setosa
In [19]: df.describe().plot(kind = "area",fontsize=27, figsize = (20,8), table = True
plt.xlabel('Statistics',)
plt.ylabel('Value')
plt title("General Statistics of Iris Dataset")
Out[19]: Text(0.5,1,'General Statistics of Iris Dataset')
In [5]: plt.scatter(iris_feat['SepalLengthCm'],iris_feat['PetalLengthCm'],alpha=1)
plt.title('Scatter Plot')
plt.xlabel('sepal_length')
plt.ylabel('petal_length')
plt show()
4 of 9 15-Mar-22, 4:19 PM
ADA_lab01 http://localhost:8888/notebooks/ADA_lab01.ipynb
5 of 9 15-Mar-22, 4:19 PM
ADA_lab01 http://localhost:8888/notebooks/ADA_lab01.ipynb
In [8]: Df = df.groupby('Species')['SepalLengthCm'].sum().to_frame().reset_index()
plt.bar(df['Species'],df['SepalLengthCm'],color = ['cornflowerblue','lightseagree
plt.title('Bar Chart')
plt.xlabel('Species')
plt.ylabel('sepal_length')
plt show()
6 of 9 15-Mar-22, 4:19 PM
ADA_lab01 http://localhost:8888/notebooks/ADA_lab01.ipynb
In [13]:
plt.figure(figsize = (10, 7))
x = df["SepalLengthCm"]
7 of 9 15-Mar-22, 4:19 PM
ADA_lab01 http://localhost:8888/notebooks/ADA_lab01.ipynb
8 of 9 15-Mar-22, 4:19 PM
ADA_lab01 http://localhost:8888/notebooks/ADA_lab01.ipynb
In [18]: df['Species'].value_counts().plot.pie(explode=[0.1,0.1,0.1],autopct='%1.1f%%'
plt show()
In [ ]:
9 of 9 15-Mar-22, 4:19 PM