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

import pandas as pd

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

import seaborn as sns

titanic = pd.read_csv('/kaggle/input/test-file/tested.csv')

titanic.shape

titanic_gender = titanic['Sex'].value_counts(normalize=True)

wp = {'linewidth': 1, 'edgecolor': 'black'}
plt.axis('equal')
plt.tight_layout()

titanic.groupby('Sex').Survived.sum()

titanic_class = titanic.groupby('Pclass')
titanic_class

titanic_class.get_group(1)

titanic_class.get_group(2)

titanic_class.get_group(3)

titanic_class.sum()

titanic_class.mean()

titanic_class['Age'].agg(['min', 'max']).plot(kind='bar')

titanic['avg_fare_class'] = titanic.groupby('Pclass')['Fare'].transform(lambda x: x.mean())

tita_df = titanic.groupby(['Embarked', 'Sex']).mean()
tita_df

titanic['Embarked'].value_counts()