#学习日记:阿里云天池,机器学习实战进阶:泰坦尼克号乘客获救预测。有一些课程代码运行报错,自己修改了,亲测能跑
#win10 Pycharm环境 ,需要用到的库请提前在terminal终端用命令下载:pip install 库名称
#3.3年龄与存活与否的关系 Age
fig, ax=plt.subplots(1,2,figsize = (18,5))
ax[0].set_yticks(range(0,110,10))
sns.violinplot("Pclass","Age",hue="Survived",data=train_data,split=True,ax=ax[0])
ax[0].set_title("Pclass and Age vs Survived")
ax[1].set_yticks(range(0,110,10))
sns.violinplot("Sex","Age",hue="Survived",data=train_data,split=True,ax=ax[1])
ax[1].set_title("Sex and Age vs Survived")
plt.show()
#分析总体的年龄分布
plt.figure(figsize=(15,5))
plt.subplot(121)
train_data["Age"].hist(bins=100)
plt