一、读入titanic.xlsx文件,按照教材示例步骤,完成数据清洗。

titanic数据集包含11个特征,分别是:

Survived:0代表死亡,1代表存活
Pclass:乘客所持票类,有三种值(1,2,3)
Name:乘客姓名
Sex:乘客性别
Age:乘客年龄(有缺失)
SibSp:乘客兄弟姐妹/配偶的个数(整数值)
Parch:乘客父母/孩子的个数(整数值)
Ticket:票号(字符串)
Fare:乘客所持票的价格(浮点数,0-500不等)
Cabin:乘客所在船舱(有缺失)
Embark:乘客登船港口:S、C、Q(有缺失)

import pandas as pd
titanic = pd.read_excel('titanic (1).xlsx')
titanic.head()

二、对titanic数据集完成以下统计操作

1.统计乘客死亡和存活人数

titanic['survived'].value_counts()

2.统计乘客中男女性别人数

titanic['sex'].value_counts()

3.统计男女获救的人数

4.统计乘客所在的船舱等级的人数

titanic['class'].value_counts()

5.使用corr()函数,判断两个属性是否具有相关性,分析舱位的高低和存活率的关系

titanic['survived'].corr(titanic['pclass'])

  

6.画出乘客票价与舱位等级的箱体图Boxplot,从图中能够得到哪些结论?

titanic.boxplot(column=['fare'],by=['pclass'],grid=False)

  

最新文章

  1. 使用Maven+Nexus+Jenkins+Svn+Tomcat+Sonar搭建持续集成环境(二)
  2. sassCore
  3. 浅析手机抓包方法实践(zt)
  4. Leetcode: Assign Cookies
  5. python面向对象编程(上)
  6. 通过store为toolbar添加按钮
  7. UIView和CALayer有什么关系
  8. Swift继承的用法
  9. 【论文:麦克风阵列增强】Signal Enhancement Using Beamforming and Nonstationarity with Applications to Speech
  10. Mysql之单表记录查询
  11. Windows phone 8.1之数据绑定(Data Binding)
  12. [Swift]LeetCode845. 数组中的最长山脉 | Longest Mountain in Array
  13. 实验楼-Git实战教程
  14. Linux Performance tool
  15. 又一个opengl教程,多多益善
  16. Google工作原理
  17. 增加centos7.3上安装php7的php-soap扩展
  18. ZooKeeper常见问题
  19. 替换换行符:回车换行CR/LF
  20. gdi+ 中发生一般性错误 wpf解决方法

热门文章

  1. 学习ES6笔记──工作中常用到的ES6语法
  2. DefinePlugin插件用法
  3. Java逆向之UML查看工具(检索记录)
  4. spf13-vim 显示neocomplete requires ...th Lua support
  5. Supermap/Cesium 开发心得----定位
  6. cesium计算当前地图范围extent以及近似当前层级zoom
  7. 《老师说的都对》- Alpha冲刺阶段博客目录
  8. oop面向对象【类与对象、封装、构造方法】
  9. linux bash变量作用域
  10. DiskCatalogMaker for Mac常见问题解答