text_html_output_1.png
import miner_a_de_datos_an_lisis_exploratorio_utilidad as utils

import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)

seed = 27912

filepath = '../input/breast-cancer-wisconsin-data/data.csv'
indexC = 'id'
targetC = 'diagnosis'
dataC = utils.load_data(filepath, indexC, targetC)

dataC.sample(5, random_state=seed)

filepathD = '../input/pima-indians-diabetes-database/diabetes.csv'
targetD = 'Outcome'
dataD = utils.pd.read_csv(filepathD, dtype={'Outcome': 'category'})

dataD.sample(5, random_state=seed)

filepathT_train = '../input/titanic/train.csv'
filepathT_test = '../input/titanic/test.csv'
filepathT_Union = '../input/titanic/gender_submission.csv'
dataT_train = utils.pd.read_csv(filepathT_train)
dataT_test = utils.pd.read_csv(filepathT_test)
dataT_Union = utils.pd.read_csv(filepathT_Union)

dataT = pd.DataFrame(columns=['PassengerId', 'Survived', 'Pclass', 'Name', 'Sex', 'Age', 'Parch', 'Ticket', 'Fare', 'Cabin', 'Embarked'], index=range(len(dataT_test) + len(dataT_train) + 1))

w = []
for i in range(len(dataT_train)):
    k = i + 1
    dataT.iloc[k]['PassengerId'] = dataT_train.iloc[i]['PassengerId']
    dataT.iloc[k]['Survived'] = dataT_train.iloc[i]['Survived']
    dataT.iloc[k]['Pclass'] = dataT_train.iloc[i]['Pclass']
    dataT.iloc[k]['Name'] = dataT_train.iloc[i]['Name']
    dataT.iloc[k]['Sex'] = dataT_train.iloc[i]['Sex']
    dataT.iloc[k]['Age'] = dataT_train.iloc[i]['Age']
    dataT.iloc[k]['SibSp'] = dataT_train.iloc[i]['SibSp']
    dataT.iloc[k]['Parch'] = dataT_train.iloc[i]['Parch']
    dataT.iloc[k]['Ticket'] = dataT_train.iloc[i]['Ticket']
    dataT.iloc[k]['Fare'] = dataT_train.iloc[i]['Fare']
    dataT.iloc[k]['Cabin'] = dataT_train.iloc[i]['Cabin']
    dataT.iloc[k]['Embarked'] = dataT_train.iloc[i]['Embarked']

for j in range(len(dataT_test)):
    i = j + len(dataT_train) + 1
    dataT.iloc[i]['PassengerId'] = dataT_test.iloc[j]['PassengerId']
    dataT.iloc[i]['Survived'] = dataT_Union.iloc[j]['Survived']
    dataT.iloc[i]['Pclass'] = dataT_test.iloc[j]['Pclass']
    dataT.iloc[i]['Name'] = dataT_test.iloc[j]['Name']
    dataT.iloc[i]['Sex'] = dataT_test.iloc[j]['Sex']
    dataT.iloc[i]['Age'] = dataT_test.iloc[j]['Age']
    dataT.iloc[i]['SibSp'] = dataT_test.iloc[j]['SibSp']
    dataT.iloc[i]['Parch'] = dataT_test.iloc[j]['Parch']
    dataT.iloc[i]['Ticket'] = dataT_test.iloc[j]['Ticket']
    dataT.iloc[i]['Fare'] = dataT_test.iloc[j]['Fare']
    dataT.iloc[i]['Cabin'] = dataT_test.iloc[j]['Cabin']
    dataT.iloc[i]['Embarked'] = dataT_test.iloc[j]['Embarked']

dataT = dataT.drop([0], axis=0)
dataT = dataT.drop(['PassengerId'], axis=1)

dataT.sample(5, random_state=seed)

CX, Cy = utils.divide_dataset(dataC, target='diagnosis')
DX, Dy = utils.divide_dataset(dataD, target='Outcome')
TX, Ty = utils.divide_dataset(dataT, target='Survived')

CX_train.sample(5, random_state=seed)

Cy_train.sample(5, random_state=seed)

dataC_train = utils.join_dataset(CX_train, Cy_train)

dataC_train.sample(5, random_state=seed)