-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
55 lines (23 loc) · 834 Bytes
/
main.py
File metadata and controls
55 lines (23 loc) · 834 Bytes
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
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Dec 3 09:12:15 2017
@author: tnitave
"""
#importing libraries
import numpy as np
import pandas as pd
import matplotlib.pyplot as pt
#--------------------Importing Data and Creating Matrix----------------
dataset = pd.read_csv('iris.csv')
X = dataset.iloc[:, :-1].values
Y = dataset.iloc[:, 4].values
#--------------------Dealing with missing data---------------------
from sklearn.preprocessing import Imputer
imputer = Imputer(missing_values = 'NaN', strategy = 'mean', axis = 0)
imputer = imputer.fit(X[:,0:4])
X[:,0:4] = imputer.transform(X[:,0:4])
#------------------Encoding Categorical Values--------------------
from sklearn.preprocessing import LabelEncoder
labelencoder_Y = LabelEncoder()
Y = labelencoder_Y.fit_transform(Y)