開始使用免費開始

EDA:比較 2010 年前後的地震規模

請為 1980 年至 2009 年的地震規模繪製 ECDF。在同一張圖上,再顯示 2010 年至 2017 年年中之間地震規模的 ECDF。地震發生時間以十進位年份表示,儲存在 NumPy 陣列 time;地震規模儲存在 NumPy 陣列 mags

本練習屬於課程

統計思維個案研究

檢視課程

練習說明

  • 使用布林索引切出 2010 年之前所有地震的規模,並將結果存入 mags_pre。同樣地,建立一個 numpy 陣列 mags_post,包含 2010 年及之後所有地震的規模。
  • 使用 plt.plot(),並以 *dcst.ecdf(____) 作為引數,為 2010 年前與 2010 年後的地震規模各自繪製 ECDF。記得為 markerlinestyle 參數指定值。
  • 按下「Submit Answer」以檢視圖表。

動手互動練習

試著完成這個範例程式碼,體驗一下這個練習。

# Get magnitudes before and after 2010
mags_pre = ____[____ < ____]
mags_post = ____[____ >= ____]

# Generate ECDFs


# Label axes and show plot
_ = plt.xlabel('magnitude')
_ = plt.ylabel('ECDF')
plt.legend(('1980 though 2009', '2010 through mid-2017'), loc='upper left')
plt.show()
編輯並執行程式碼