Skip to content

Instantly share code, notes, and snippets.

@pmallory
Created December 8, 2014 03:47
Show Gist options
  • Save pmallory/f89bceacb8c55d158728 to your computer and use it in GitHub Desktop.
Save pmallory/f89bceacb8c55d158728 to your computer and use it in GitHub Desktop.
# coding: utf-8
import csv
from collections import Counter
from pprint import pprint
with open('./440801.csv') as f:
# data from
obs = []
csv = csv.DictReader(f)
for line in csv:
obs.append(line)
temps = Counter()
for date in obs:
mint = .18*int(date.get('TMIN'))+32
maxt = .18*int(date.get('TMAX'))+32
for temp in range(0,100):
if mint < temp < maxt:
temps[temp] += 1
print temps.most_common(1)[0][1]/float(len(obs))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment