Created
January 22, 2013 01:27
-
-
Save garbados/4591223 to your computer and use it in GitHub Desktop.
Coding help w/ Rick
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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