In [1]:
#importing what we'll need
import numpy as np
import pandas as pd
%matplotlib inline
import matplotlib.pyplot as plt

In [2]:
# Just earthquakes from the past hour
#data = pd.read_csv("http://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/all_hour.csv")

# All earthquake events in the last month
data = pd.read_csv("http://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/all_month.csv")

# Only large earthquakes (magnitude 4.5 or greater) in teh past month
#data = pd.read_csv("http://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/4.5_month.csv")

In [3]:
data.head(4)


Out[3]:
time latitude longitude depth mag magType nst gap dmin rms ... updated place type horizontalError depthError magError magNst status locationSource magSource
0 2017-08-10T15:35:12.560Z 61.551700 -149.798600 34.00 1.30 ml NaN NaN NaN 0.51 ... 2017-08-10T15:39:15.847Z 8km ENE of Big Lake, Alaska earthquake NaN 0.10 NaN NaN automatic ak ak
1 2017-08-10T15:30:44.980Z 38.328300 -118.517700 1.50 1.60 ml 12.0 95.56 0.10900 NaN ... 2017-08-10T15:33:33.864Z 23km SSE of Hawthorne, Nevada earthquake NaN NaN NaN NaN automatic nn nn
2 2017-08-10T15:14:51.550Z 33.962667 -116.644833 16.30 0.79 ml 17.0 65.00 0.07571 0.19 ... 2017-08-10T15:37:40.284Z 11km SSW of Morongo Valley, CA earthquake 0.43 0.87 0.106 18.0 reviewed ci ci
3 2017-08-10T14:59:01.230Z 33.965333 -116.652000 15.69 1.52 ml 50.0 32.00 0.06817 0.18 ... 2017-08-10T15:04:55.394Z 11km SW of Morongo Valley, CA earthquake 0.23 0.52 0.109 27.0 reviewed ci ci

4 rows × 22 columns


In [4]:
# Set variables for scatter plot
x = data.longitude
y = data.latitude

plt.scatter(x,y)
plt.title('Earthquakes around the world (last month)')
plt.xlabel('Longitude')
plt.ylabel('Latitude')

# This actually shows the plot
plt.show()



In [ ]: