#importing libraries------------------------ALWAYS USED
import numpy as np
import matplotlib as plt
import pandas as pd


#importing dataset--------------------------ALWAYS USED
dataset = pd.read_csv("Data.csv");
X = dataset.iloc[:, :-1].values
Y = dataset.iloc[:, -1].values




#Removing NaN
from sklearn.impute import  SimpleImputer
imputer = SimpleImputer(missing_values = np.nan, strategy = "mean")
X[:,1:3] = imputer.fit_transform(X[:, 1:3])
print(X)




#Encoding the categorical data
from sklearn.compose import ColumnTransformer
from sklearn.preprocessing import OneHotEncoder
ct = ColumnTransformer(transformers = [('encoder', OneHotEncoder(), [0])], remainder = 'passthrough')
X = ct.fit_transform(X)
print(X)




#Splitting Dataset--------------------------ALWAYS USED
from sklearn.model_selection import train_test_split
X_train, X_test, Y_train, Y_test = train_test_split(X, Y, test_size=0.2, random_state=1)
print()
print(X_train)
print(X_test)
print(Y_train)
print(Y_test)




#Feature Scaling
from sklearn.preprocessing import StandardScaler
sc = StandardScaler()
X_train[:, 3:] = sc.fit_transform(X_train[:, 3:])
X_test[:, 3:] = sc.transform(X_test[:, 3:])
print(X_train)
print(X_test)

