text_html_output_1.png
from sklearn.model_selection import train_test_split

from sklearn.model_selection import train_test_split

from sklearn.preprocessing import StandardScaler, Normalizer, MinMaxScaler

import numpy as np #for mathematical manipulation of the data

import pandas as pd #for structuring the data

train_data = pd.read_csv('train.csv')
test_data = pd.read_csv('test.csv')

dataTrain = train_data.drop(['passenger_ID', 'name', 'ticket', 'cabin'], axis=1)
passengerid = test_data['passenger_ID']
dataTest = test_data.drop(['passenger_ID', 'name', 'ticket', 'cabin'], axis=1)

dataTrain = pd.get_dummies(dataTrain, columns=['sex'])

dataTest = pd.get_dummies(dataTest, columns=['sex'])

dataTrain = pd.get_dummies(dataTrain, columns=['embarked'])
dataTest = pd.get_dummies(dataTest, columns=['embarked'])

y = dataTrain['survived']
x = dataTrain.drop('survived', axis=1)
(x.shape, y.shape)

from sklearn.preprocessing import StandardScaler, Normalizer, MinMaxScaler
stdscale = MinMaxScaler()
x_new = stdscale.fit_transform(x)
testd = stdscale.transform(dataTest)
(x_new.shape, testd.shape)

X = pd.DataFrame(x_new, columns=x.columns)
testData = pd.DataFrame(testd, columns=dataTest.columns)

from sklearn.model_selection import train_test_split
x_train, x_test, y_train, y_test = train_test_split(X, y, test_size=0.1, random_state=42)
(x_train.shape, y_train.shape)

np.unique(y_train)