开始使用免费开始使用

计算数值汇总

您已经学习了如何以多种方式展示并注释时间序列数据,但汇总统计同样很有价值。完成这项任务,能让您分享并讨论数据的统计特性,从而更有力地支撑您生成的图表。在 pandas 中,您可以通过以下命令快速获取 DataFrame 各列的汇总信息:

print(df.describe())

这将打印包括均值、标准差、最小值、最大值以及数值列的观测数量等统计信息,适用于 pandas DataFrame 中所有数值型列。

本练习是课程的一部分

用 Python 可视化时间序列数据

查看课程

练习说明

  • 打印 co2_levels DataFrame 的统计汇总。
  • 打印 co2_levels DataFrame 中报告的最小值。
  • 打印 co2_levels DataFrame 中报告的最大值。

交互式实操练习

通过完成这段示例代码来试试这个练习。

# Print out summary statistics of the co2_levels DataFrame
print(____.____)

# Print out the minima of the co2 column in the co2_levels DataFrame
print(____)

# Print out the maxima of the co2 column in the co2_levels DataFrame
print(____)
编辑并运行代码