-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCaseStudyStep4.py
More file actions
93 lines (65 loc) · 1.96 KB
/
Copy pathCaseStudyStep4.py
File metadata and controls
93 lines (65 loc) · 1.96 KB
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
Border = "-"*30
##########################################
# Step1 : Load the Data Set
##########################################
print(Border)
print("Step1 : Load the DataSet")
print(Border)
DataPath = "iris.csv"
df = pd.read_csv(DataPath)
print("Dataset Loaded Succefully")
print("Initial enteries form dataset :")
print(df.head())
#print(df.tail()) -> for tail
##########################################
# Step2 : Data Analysis (EDA)
##########################################
print(Border)
print("Step2 : Data Analysis (EDA)")
print(Border)
print("Shape of dataset ",df.shape)
print("Column name :", list(df.columns))
print("Missing values per column : ")
print(df.isnull().sum())
print("Class distribution (species count)")
print(df["species"].value_counts())
print("Satatical report of Dataset :")
print(df.describe())
#####################################################
# Step3 : Decide independent & dependent variables
####################################################
print(Border)
print("Step3 : Decide independent & dependent variables")
print(Border)
# X : Independent Variable (features)
# Y : Dependent Variable (lables)
feature_col = [
"sepal length (cm)",
"sepal width (cm)",
"petal length (cm)",
"petal width (cm)"
]
X = df[feature_col]
Y = df["species"]
print("X Shape :",X.shape)
print("Y Shape :",Y.shape)
#####################################################
# Step4 : visualization of dataset
####################################################
print(Border)
print("Step4 : visualization of dataset")
print(Border)
#Scatter plot
plt.figure(figsize=(7,5))
for sp in df["species"].unique():
temp = df[df["species"] == sp]
plt.scatter(temp["petal length (cm)"],temp["petal width (cm)"],label = sp)
plt.title("Marvellous Iris Case study")
plt.xlabel("petal length (cm)")
plt.ylabel("petal width (cm)")
plt.legend()
plt.grid()
plt.show()