BaşlayınÜcretsiz Başlayın

EDA: Comparing magnitudes before and after 2010

Make an ECDF of earthquake magnitudes from 1980 through 2009. On the same plot, show an ECDF of magnitudes of earthquakes from 2010 through mid-2017. The time of the earthquakes, as decimal years, are stored in the NumPy array time and the magnitudes in the NumPy array mags.

Bu egzersiz

Case Studies in Statistical Thinking

kursunun bir parçasıdır
Kursu Görüntüle

Egzersiz talimatları

  • Use Boolean indexing to slice out the magnitudes of all earthquakes before 2010 and store the result in mags_pre. Similarly, generate a numpy array mags_post that has all magnitudes of earthquakes in and after 2010.
  • Use plt.plot() with a *dcst.ecdf(____) argument to make ECDFs for pre- and post- 2010 earthquake magnitudes. Remember to specify arguments for the marker and linestyle parameters.
  • Hit 'Submit Answer' to view the plot.

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

# 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()
Kodu Düzenle ve Çalıştır