平均数 vs. 中位数
您已经学会使用 numpy 函数来更好地把握数据特征。
棒球数据以一个 2D numpy 数组给出,包含 3 列(身高、体重、年龄)和 1015 行。该 numpy 数组名为 np_baseball。不过,在重组数据后,您注意到部分身高值异常偏高。请按照说明操作,看看在处理所谓的"离群值"(outliers)时,哪种汇总统计量更合适。np_baseball 已可用。
本练习是课程的一部分
Python 入门
练习说明
- 创建
numpy数组np_height_in,其值等于np_baseball的第一列。 - 打印
np_height_in的均值。 - 打印
np_height_in的中位数。
交互式实操练习
通过完成这段示例代码来试试这个练习。
import numpy as np
# Create np_height_in from np_baseball
# Print out the mean of np_height_in
# Print out the median of np_height_in