开始使用免费开始使用

均值与中位数

汇总统计(summary statistics)顾名思义,就是用一个统计量来概括许多数值。例如,均值、中位数、最小值、最大值和标准差都是常见的汇总统计。计算这些指标可以帮助您更快把握数据的整体情况,即使数据量很大也不例外。

sales 包含部分 Walmart 门店的每周销量数据,列包括 storetypedepartmentdateweekly_salesis_holidaytemperature_cfuel_price_usd_per_lunemployment

本练习是课程的一部分

使用 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(____)
编辑并运行代码