1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
from plot import plot_data
def process_data(file):
temp_data_file = open(file)
data = []
for line in temp_data_file.readlines():
split_line = line.split(",")
date = split_line[0].split("/")
day = ____(a)____
month = ____(b)____
year = ____(c)____
temperature = float(____(d)____)
data.append(((year, month, day), temperature))
return sorted(data)
def collect_averages_and_plot(infile, outfile):
data = process_data(____(a)____)
xs = []
ys = []
prev = None
total = 0.0
num = 0
for x in data:
d = ____(b)____
t = ____(c)____
if prev != d and prev is not None:
xs.append(____(d)____)
ys.append(____(e)____)
total = 0.0
num = 0
total += t
num += 1
prev = d
xs.append(____(f)____)
ys.append(____(g)____)
plot_data(____(h)____, xs, ys)
collect_averages_and_plot("pasadena.csv", "out.png")