均值与中位数
汇总统计(summary statistics)顾名思义,就是用一个统计量来概括许多数值。例如,均值、中位数、最小值、最大值和标准差都是常见的汇总统计。计算这些指标可以帮助您更快把握数据的整体情况,即使数据量很大也不例外。
sales 包含部分 Walmart 门店的每周销量数据,列包括 store、type、department、date、weekly_sales、is_holiday、temperature_c、fuel_price_usd_per_l 和 unemployment。
本练习是课程的一部分
使用 pandas 进行数据处理
练习说明
- 先探索新的 DataFrame:打印
sales的前几行。 - 打印
sales的列信息。 - 打印
weekly_sales列的均值。 - 打印
weekly_sales列的中位数。
交互式实操练习
通过完成这段示例代码来试试这个练习。
# Print the head of the sales DataFrame
print(____)
# Print the info about the sales DataFrame
print(____)
# Print the mean of weekly_sales
print(____)
# Print the median of weekly_sales
print(____)