始める無料で始める

要約統計量を計算する

時系列データをさまざまな方法で表示・注釈する方法を学びましたが、データの要約統計量を確認することも有益です。これができると、作成したプロットを裏付ける統計的な特徴について共有・議論しやすくなります。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(____)
コードを編集して実行