Practical 10 code
Practical 10 code
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
In [22]: df = pd.read_csv("IRIS.csv")
In [23]: df.head()
Out[23]:
sepal_length sepal_width petal_length petal_width species
In [24]: df.mean()
In [25]: df.median()
In [26]: df.mode()
Out[26]:
sepal_length sepal_width petal_length petal_width species
In [27]: df.std()
1/5
In [28]: df.min()
In [29]: df.max()
In [30]: df.var()
In [35]: plt.hist(df['sepal_length'])
plt.show()
2/5
In [43]: plt.figure(figsize = (10,7))
df.boxplot()
plt.show()
<matplotlib.figure.Figure at 0x7f68b933f750>
3/5
In [48]: fig, axes = plt.subplots(2, 2, figsize=(16,8))
4/5
In [50]: fig, axes = plt.subplots(2, 2, figsize=(16,9))
axes[0,0].set_title("Distribution of Sepal Length")
sns.boxplot(y="sepal_length", x="species", data=df, orient='v', ax=axes[0,
0])
axes[0,1].set_title("Distribution of Sepal Length")
sns.boxplot(y="sepal_width", x="species", data=df, orient='v', ax=axes[0,
1])
axes[1,0].set_title("Distribution of Sepal Length")
sns.boxplot(y="petal_length", x="species", data=df, orient='v', ax=axes[1,
0])
axes[1,1].set_title("Distribution of Sepal Length")
sns.boxplot(y="petal_length", x="species", data=df, orient='v', ax=axes[1,
1])
plt.show()
5/5