3_Earthquake Magnitude Grid

Each cell represents one minute — the 60 columns, the 60 minutes in an hour and the 24 rows, the 24 hours in a day. All earthquakes are recorded in the cell corresponding to the minute they occurred, magnitude is represented by the color of the cell (darker being more intense). (note, if there was more than on earthquake in any given minute, the first earthquake to occur is recorded in the cell that represents that minute)

import csv
file_path = "insert file path here"
data = []
with open(file_path, 'rU') as f:
spamreader = csv.reader(f, dialect='excel', delimiter=',', quotechar='"')
header = spamreader.next()
for row in spamreader:
grid = [[1]*60 for n in range(24)]
for cell in data:
grid[int(cell[0])][int(cell[1])]= float(cell[5])
w = 20
def setup():
# fill(0)
def draw():
x,y = 0,0
for row in grid:
for n in row:
if n == 1:
fill (255,255,255)
fill (255,255-(n*20),255-(n*42.5))
rect (x,y,w,w)
x = x + w
y = y + w
x = 0