text_html_output_1.png
import pandas as pd

import seaborn as sns

train = pd.read_csv('/kaggle/input/titanic/train.csv')
test = pd.read_csv('/kaggle/input/titanic/test.csv')

def wrangle(df):
    df['Male'] = df['Sex'].map(lambda x: x == 'male')
    df['Pronoun'] = df['Name'].map(lambda x: x.split(', ')[1].split('.')[0])
    df['Prefix'] = df['Ticket'].map(lambda x: x.split(' ')[0].split('/')[0].replace('.', '') if ' ' in x else '')
    df['Letter'] = df['Cabin'].fillna('00').map(lambda x: x[0])
    df['Family'] = df['SibSp'] + df['Parch']
    df = df.drop(['PassengerId', 'Name', 'Ticket', 'Sex', 'Cabin'], axis=1)
    return df

new_train = wrangle(train)

sns.set(style='whitegrid')
sns.despine(left=True)
sns.histplot(new_train['Age'], bins=20)