Analysis of Iris dataset¶
Using Notebook, let us try to dig deep in this Iris dataset.
In [19]:
import matplotlib
import matplotlib.pyplot as plt
%matplotlib inline
import seaborn as sns
import numpy as np
import pandas as pd
iris = sns.load_dataset("iris")
In [20]:
#Print shape of the data
print (iris.shape)
In [21]:
#print top few rows
print(iris.head(5))
In [22]:
#summary of iris data
print (iris.describe())
In [23]:
#print counts of each species
print (iris["species"].value_counts())
In [24]:
# Swarmplots to understand the distribution
plt.subplots_adjust(hspace=.5,wspace = 0.2)
plt.subplot(221)
sns.swarmplot(x="species", y="sepal_length", data=iris);
plt.subplot(222)
sns.swarmplot(x="species", y="sepal_width", data=iris);
plt.subplot(223)
sns.swarmplot(x="species", y="petal_length", data=iris);
plt.subplot(224)
sns.swarmplot(x="species", y="petal_width", data=iris);
plt.show()
In [25]:
# Pair plot of iris features of Regression kind to identify relationships
plt.clf()
sns.pairplot(iris, hue="species", size=3, kind="reg")
plt.show()
No comments:
Post a Comment