Permalink
Browse files

csv process command line filename argument fix

changed so that in the command line the user only has to write the
filename instead of using the full path to the 'data' directory
(example: python csvProcessShahin.py 1_2012_Nov_05_2141.csv) and also
fixed a problem with the csv header for the correct key response
  • Loading branch information...
ctmdev
ctmdev committed Nov 15, 2012
1 parent 5cc2ab3 commit 12f4dc662798f274a59045b52c5e70649411d434
Showing with 4 additions and 4 deletions.
  1. +3 −3 src/csvProcessShahin.py
  2. +1 −1 src/csvProcessShahin.py~
View
@@ -8,7 +8,7 @@
def main():
#csv filename to evaluate => first argument in command prompt
- filename = sys.argv[1]
+ filename = '../data/' + sys.argv[1]
with open (filename) as csvfile:
a = array([row.strip().split(',') for row in csvfile])
@@ -19,13 +19,13 @@ def main():
print coldict
#calculate the number of correct answers
- numcorr = coldict['enterResp.corr']
+ numcorr = coldict['key_resp.corr']
sumcorr = sum([map(int, i) for i in numcorr])
print 'number of correct responses: ' + str(sumcorr)
#calculate the frequency of responses
d = defaultdict(int)
- for ans in coldict['enterResp.keys']:
+ for ans in coldict['key_resp.corr']:
d[ans] += 1
print 'number times answered BA: ' + str(d['1'])
print 'number times answered WA: ' + str(d['2'])
View
@@ -8,7 +8,7 @@ from collections import defaultdict
def main():
#csv filename to evaluate => first argument in command prompt
- filename = sys.argv[1]
+ filename = '../data/' + sys.argv[1]
with open (filename) as csvfile:
a = array([row.strip().split(',') for row in csvfile])

0 comments on commit 12f4dc6

Please sign in to comment.