text_plain_output_1.png image_output_1.png
import matplotlib.pyplot as plt

import numpy as np

import numpy as np # linear algebra

import pandas as pd

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

import seaborn as sns

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

train.shape

train.isnull().sum()

mask = np.triu(train.drop(['PassengerId'], axis=1).corr())

fig = sns.catplot(x='Pclass',y='Age',data=train,hue='Survived',ci=None)

fig = sns.barplot(x='Pclass',y='Survived',data=train, hue='Sex',ci=None)
for container in fig.containers:
    fig.bar_label(container,label_type='center',fmt='%1.2f%%')

fig = sns.barplot(x='Pclass', y='Survived', data=train)
fig.bar_label(fig.containers[0],label_type='center',fmt='%1.1f%%')

fig = sns.barplot(x='Survived',y='Sex',data=train)
fig.bar_label(fig.containers[0],size=14,label_type='center',fmt='%1.2f%%')

g = sns.FacetGrid(train, col='Embarked', size=6)
g.map(sns.barplot, 'Pclass', 'Survived', hue=train.Sex)
g.add_legend()

fig = sns.barplot(x='Embarked', y='Survived', data=train)
fig.bar_label(fig.containers[0], size=14, label_type='center', fmt='%1.2f%%')