計算數值摘要
你已經學會用多種方式顯示並註解時間序列資料,但蒐集資料的摘要統計也同樣重要。能做到這點,能讓你分享並討論資料的統計特性,進一步支援你產生的圖表。在 pandas 中,可以用以下指令快速取得 DataFrame 各欄位的摘要:
print(df.describe())
這會列印包含平均數、標準差、最小值、最大值,以及所有數值欄位的觀測筆數等統計資訊。
本練習屬於課程
使用 Python 視覺化時間序列資料
練習說明
- 列印
co2_levelsDataFrame 的統計摘要。 - 列印
co2_levelsDataFrame 中回報的最小值。 - 列印
co2_levelsDataFrame 中回報的最大值。
動手互動練習
試著完成這個範例程式碼,體驗一下這個練習。
# 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(____)