-
Notifications
You must be signed in to change notification settings - Fork 0
/
EdaByPreeti.py
52 lines (39 loc) · 1.38 KB
/
EdaByPreeti.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import math
import seaborn as sns
#importing the iris Dataset
iris = pd.read_csv("iris.csv")
iris.head()
#shape
iris.shape
iris.columns
iris['Species'].value_counts() #balanced dataset
#2D -scatter plot
iris.plot(kind = 'scatter',x = 'SepalLengthCm',y = 'SepalWidthCm')
plt.show()
sns.set_style("whitegrid")
sns.FacetGrid(iris, hue = "Species",height = 5).map(plt.scatter,'PetalLengthCm','PetalWidthCm').add_legend()
plt.show
#pair plots
plt.close()
sns.set_style("whitegrid")
sns.pairplot(iris, hue = "Species", height = 3)
plt.show()
#histogram
#1-D scatter plot
iris = pd.read_csv("Iris.csv")
import numpy as np
iris_setosa = iris.loc[iris["Species"]=="Iris-setosa"];
iris_versicolor = iris.loc[iris["Species"]=="Iris-versicolor"];
iris_virginica = iris.loc[iris["Species"]=="Iris-virginica"];
plt.plot(iris_setosa["PetalLengthCm"],np.zeros_like(iris_setosa['PetalLengthCm']),'o')
plt.plot(iris_versicolor["PetalLengthCm"],np.zeros_like(iris_versicolor['PetalLengthCm']),'o')
plt.plot(iris_virginica["PetalLengthCm"],np.zeros_like(iris_virginica['PetalLengthCm']),'o')
sns.set_style("whitegrid")
sns.FacetGrid(iris, hue="Species",height = 5).map(sns.distplot,"PetalLengthCm").add_legend()
plt.show
sns.set_style("whitegrid")
sns.FacetGrid(iris, hue="Species",height = 5).map(sns.distplot,"PetalWidthCm").add_legend()
plt.show