def get_name_features(train):
    train['num_name_chars'] = train['Name'].apply(len)
    train['num_name_capitals'] = train['Name'].apply((lambda x: sum((1 for c in x if c.isupper()))))
    train['name_caps_vs_length'] = train.apply((lambda row: (row['num_name_capitals'] / (row['num_name_chars'] + 1e-05))), axis=1)
    train['num_name_exclamation_marks'] = train['Name'].apply((lambda x: x.count('!')))
    train['num_name_question_marks'] = train['Name'].apply((lambda x: x.count('?')))
    train['num_name_punctuation'] = train['Name'].apply((lambda x: sum((x.count(w) for w in '.,;:'))))
    train['num_name_symbols'] = train['Name'].apply((lambda x: sum((x.count(w) for w in '*&$%'))))
    train['num_name_words'] = train['Name'].apply((lambda x: len(x.split())))
    return train
def get_name_features(train):
    train['num_name_chars'] = train['Name'].apply(len)
    train['num_name_capitals'] = train['Name'].apply((lambda x: sum((1 for c in x if c.isupper()))))
    train['name_caps_vs_length'] = train.apply((lambda row: (row['num_name_capitals'] / (row['num_name_chars'] + 1e-05))), axis=1)
    train['num_name_exclamation_marks'] = train['Name'].apply((lambda x: x.count('!')))
    train['num_name_question_marks'] = train['Name'].apply((lambda x: x.count('?')))
    train['num_name_punctuation'] = train['Name'].apply((lambda x: sum((x.count(w) for w in '.,;:'))))
    train['num_name_symbols'] = train['Name'].apply((lambda x: sum((x.count(w) for w in '*&$%'))))
    train['num_name_words'] = train['Name'].apply((lambda x: len(x.split())))
    return train