text_plain_output_1.png
import numpy as np

import pandas as pd

import pandas as pd
import csv as csv
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
from time import time
train = pd.read_csv('../input/train.csv', dtype={'Age': np.float64})
test = pd.read_csv('../input/test.csv', dtype={'Age': np.float64})
data = np.array(train)
test_data = np.array(test)

number_passengers = np.size(data[0:, 1].astype(np.float))
number_survived = np.sum(data[0:, 1].astype(np.float))
proportion_survivors = number_survived / number_passengers

women_only_stats = data[0:, 4] == 'female'
men_only_stats = data[0:, 4] != 'female'

women_onboard = data[women_only_stats, 1].astype(np.float)
men_onboard = data[men_only_stats, 1].astype(np.float)
proportion_women_survived = np.sum(women_onboard) / np.size(women_onboard)
proportion_men_survived = np.sum(men_onboard) / np.size(men_onboard)
print('Proportion of women who survived is %s' % proportion_women_survived)
print('Proportion of men who survived is %s' % proportion_men_survived)