aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xregenWebAssign.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/regenWebAssign.py b/regenWebAssign.py
index 788ecb8..ca6ffd4 100755
--- a/regenWebAssign.py
+++ b/regenWebAssign.py
@@ -24,13 +24,19 @@ headers[2]='SID'
headers[3]='TotalPcnt'
headers[4]='TotalScore'
-d = pd.read_csv(infile, skiprows=9, header=None, names=headers)
+d = pd.read_csv(infile, skiprows=[0,1,2,3,4,5,7,8], header=None, names=headers)
+d.loc[0, 'FullName']='MaxScore'
+d.loc[0, 'UserName']='MaxScore'
+
# cleanup
-index = d[:][5:] == 'ND'
+c = d.columns
+c=c.drop(['FullName', 'UserName', 'SID'])
+index = d[c] == 'ND'
d[index] = np.nan
-index = d[:][5:] == 'NS'
+index = d[c] == 'NS'
d[index] = np.nan
d['UserName'].replace('@wm$', '', regex=True, inplace=True)
+d['UserName'].replace('@email.wm.edu$', '@wm.edu', regex=True, inplace=True)
d.to_csv('WebAssign.csv')