# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Python 3.8.3 32-bit
#     metadata:
#       interpreter:
#         hash: 4c7625a7b7bc1475d42281aea666375b38ad5bd77caf7d945bdf9d982138d0a4
#     name: python3
# ---

#importing libraries
import numpy as np  #contain mathematical functions
import pandas as pd #used to import and manage data-sets 


#importing datasets
datasets=pd.read_csv('Data.csv')
x = datasets.iloc[:,:-1].values
y = datasets.iloc[:,3].values

# handling the missing data
from sklearn.impute import SimpleImputer
imputer=SimpleImputer(missing_values=np.nan,strategy="mean")
imputer=imputer.fit(x[:,1:3])
x[:,1:3]=imputer.transform(x[:,1:3])


# Encoding categorical data
from sklearn.preprocessing import LabelEncoder, OneHotEncoder
labelencoder_x = LabelEncoder()
x[ : , 0] = labelencoder_x.fit_transform(x[ : , 0])


onehotencoder = OneHotEncoder()
x = onehotencoder.fit_transform(x).toarray()
labelencoder_y = LabelEncoder()
y =  labelencoder_y.fit_transform(y)


# +
# splitting the datasets into training sets and test sets
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 = 0)

from sklearn.preprocessing import StandardScaler
sc_X = StandardScaler()
X_train = sc_X.fit_transform(X_train)
X_test = sc_X.fit_transform(X_test)
# -



StarcoderdataJupyterScriptsDedupFiltered