text_html_output_1.png
import pandas as pd

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

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

titanic.shape

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

titanic_class = titanic.groupby('Pclass')
titanic_class

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

titanic['fare_aboce_avg'] = titanic['avg_fare_class'] < titanic['Fare']
titanic