平均值与中位数
现在,你已经学会了怎么使用 numpy 的函数来更好地理解数据。
棒球数据存放在一个二维 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