第1关:存活率与性别和船舱等级之间的关系
import pandas as pd
import numpy as np
import seaborn as sns
import warnings
warnings.filterwarnings("ignore")
sns.set()
import matplotlib.pyplot as plt
from matplotlib.pyplot import MultipleLocator
def student():
# ********* Begin *********#
a=pd.read_csv('Task1/train.csv')
fig,axes=plt.subplots(1,2)
sns.violinplot(x="Pclass",y="Age",data=a,split=True,ax=axes[0],hue='Survived') #上图
sns.violinplot(x="Sex",y="Age",split=True,data=a,hue='Survived',ax=axes[1]) #下图
plt.savefig('Task1/img/T1.png')
plt.show()
# ********* End *********#
第2关:各个口岸的生还率
import pandas as pd
import numpy as np
import seaborn as sns
import warnings
warnings.filterwarnings("ignore")
sns.set()
import matplotlib.pyplot as pl