Skip to content

Instantly share code, notes, and snippets.

@garbados
Created January 22, 2013 01:27
Show Gist options
  • Save garbados/4591223 to your computer and use it in GitHub Desktop.
Save garbados/4591223 to your computer and use it in GitHub Desktop.
Coding help w/ Rick
import csv
from collections import Counter
class Reading(object):
def __init__(self, **kwargs):
for k,v in kwargs.iteritems():
setattr(self, k, v)
file_list = [] # list of files
readings = []
for fp in file_list:
with open(fp, 'r') as f:
reader = csv.DictReader(f)
values = Counter([line['value'] for line in reader])
readings.append(Reading(
id=fp,
nan=values['NaN'],
zero=values['0']
))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment