Created
April 27, 2015 06:48
-
-
Save Quiark/7e7cf20e2749f52ef7ed to your computer and use it in GitHub Desktop.
Loading the strokes.csv
This file contains hidden or 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
def load_3d_csv(fname): | |
sta = [] | |
with open(fname, 'rb') as inf: | |
rdr = csv.reader(inf, delimiter=';') | |
for ix, row in enumerate(rdr): | |
try: | |
if ix == 0: header = row | |
else: sta.append({header[y]: eval(row[y]) for y in range(len(row)) if row[y] != ''}) | |
except SyntaxError as e: | |
logging.error('Problem reading {} at line {}'.format(fname, ix)) | |
raise e | |
return sta |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment