# -*- coding: utf-8 -*-
"""
Created on Mon May 15 13:41:14 2023

@author: black
"""
import numpy as np
import pandas as pd
titanic = pd.read_csv("C:\\Users\\black\\Desktop\\ch15\\titanic.csv")

titanic.drop(['PassengerId','Ticket','Name'], inplace=True, axis=1)
print(titanic.head())

'''
table = pd.pivot_table(data=titanic, index=['Sex'])
table.plot(kind="bar")

'''

'''
table = pd.pivot_table(titanic, index=['Sex','Pclass'])
print(table)
table.plot(kind="bar")
'''

'''
table = pd.pivot_table(titanic ,index=['Sex','Pclass'],
	aggfunc='Age':np.mean,'Survived':np.sum})
print(table)
table.plot(kind="bar")
'''
table = pd.pivot_table(titanic ,index=['Sex','Pclass'],
	values=["Survived"],aggfunc=np.mean)
print(table)
table.plot(kind="bar")
'''
table = pd.pivot_table(titanic ,index=['Sex'],
	columns=['Pclass'],values=['Survived'],aggfunc=np.sum)
print(table)
table.plot(kind='bar')
'''