Last active
December 18, 2018 18:51
-
-
Save havron/554d0ffaec20a466a7f8ecca4d76c5da to your computer and use it in GitHub Desktop.
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
#!/usr/bin/env python3 | |
# coding: utf-8 | |
import pandas as pd | |
import sys | |
import os | |
# pass in infile and CMSX assignment name as commandline args | |
if len(sys.argv) < 3: | |
print("Usage: python3 {}".format(os.path.basename(__file__))\ | |
+"<gradescope_csv_path> <cmsx_assignment_name>") | |
sys.exit() | |
INFILE_GRADESCOPE = sys.argv[1] | |
ASSN_NAME = sys.argv[2] | |
OUTFILE_CMSX = 'cmsx_scores.csv' | |
# CMSX format expects the following columns: | |
# 'NetID', ASSN_NAME, 'Adjustments', 'Total', 'Add Comments' | |
df = pd.read_csv(INFILE_GRADESCOPE) | |
# Rename scores and NetIDs | |
df = df.rename(columns={'Total Score': ASSN_NAME, \ | |
'SID': 'NetID'}) | |
# Drop other Gradescope-specific columns | |
# keep NetID as first-col (CMSX dependency) | |
df = df[['NetID', ASSN_NAME]] | |
# Drop students with no score | |
df = df.dropna(subset=[ASSN_NAME]) | |
# Write to OUTFILE_CMSX | |
df.to_csv(OUTFILE_CMSX, index=False) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment