開始使用免費開始

Mean 與 median

「摘要統計」顧名思義,就是用一個統計量來概括很多數值。像是平均數(mean)、中位數(median)、最小值、最大值、標準差,都是摘要統計。計算摘要統計可以讓你更快掌握資料的整體狀況,即使資料量很大也一樣。

sales 包含部分 Walmart 門市的每週銷售資料,欄位有 storetypedepartmentdateweekly_salesis_holidaytemperature_cfuel_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(____)
編輯並執行程式碼