text_plain_output_1.png
import pandas as pd

train_df = pd.read_csv('../input/train.csv')
test_df = pd.read_csv('../input/test.csv')

def includeFamilySize(df):
    df['FamilySize'] = df['SibSp'] + df['Parch'] + 1
    df['isAlone'] = 0
    df.loc[df['FamilySize'] == 1, 'isAlone'] = 1

def immute_ages(cols):
    Age = cols[0]
    Pclass = cols[1]
    if pd.isnull(Age):
        if Pclass == 1:
            return 38
        if Pclass == 2:
            return 30
        else:
            return 25
    else:
        return Age

train_df[pd.isnull(train_df['Embarked'])]

def fare_age_Categ(df):
    df['CategoricalFare'] = pd.qcut(df['Fare'], 4)
    df['CategoricalAge'] = pd.cut(df['Age'], 5)

retest = pd.read_csv('test.csv')

final_df = pd.DataFrame({'PassengerId': retest['PassengerId'], 'Survived': svc_pred_test})
final_df.to_csv('rf.csv', index=False)