diff options
author | Eugeniy E. Mikhailov <evgmik@gmail.com> | 2024-10-23 23:11:25 -0400 |
---|---|---|
committer | Eugeniy E. Mikhailov <evgmik@gmail.com> | 2024-10-23 23:11:25 -0400 |
commit | ec3f2c041e135a7ced9dc5b654e364f0bab0765e (patch) | |
tree | 3d5fed30fadcdf3ec7688589fe18b56e11a272a5 | |
parent | 9aea1f65dc70be3d2ed889caa64c2f4072bdfcc4 (diff) | |
download | GradeBook-ec3f2c041e135a7ced9dc5b654e364f0bab0765e.tar.gz GradeBook-ec3f2c041e135a7ced9dc5b654e364f0bab0765e.zip |
black formatter
-rwxr-xr-x | toBlackboardCSV.py | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/toBlackboardCSV.py b/toBlackboardCSV.py index 3694edc..7804070 100755 --- a/toBlackboardCSV.py +++ b/toBlackboardCSV.py @@ -10,32 +10,41 @@ import sqlite3 infile = sys.argv[1] con = sqlite3.connect(infile) -#dIn=pd.read_sql("Select * from 'GradesTable' where GroupName='student'", con) -dIn=pd.read_sql("Select * from 'GradesTable'", con) +# dIn=pd.read_sql("Select * from 'GradesTable' where GroupName='student'", con) +dIn = pd.read_sql("Select * from 'GradesTable'", con) dOut = dIn.copy() # replacing user names in accordance with BlackBoard -dOut['UserName'] = dOut['UserName'].str.replace('@.*$', '', regex=True) -dOut.rename(columns={'UserName':'Username'}, inplace=True) +dOut["UserName"] = dOut["UserName"].str.replace("@.*$", "", regex=True) +dOut.rename(columns={"UserName": "Username"}, inplace=True) # exclude inforows -dOut = dOut.loc[ dOut['GroupName'].isin(['student']) ] +dOut = dOut.loc[dOut["GroupName"].isin(["student"])] # remove unneeded info cols -infoCol=['FirstName', 'LastName', 'GroupName', 'UserHiddenColums', 'UserHiddenGroups', 'UserHiddenGradeCategories', 'SectionNum', 'IdNum'] +infoCol = [ + "FirstName", + "LastName", + "GroupName", + "UserHiddenColums", + "UserHiddenGroups", + "UserHiddenGradeCategories", + "SectionNum", + "IdNum", +] dOut = dOut.drop(infoCol, axis=1) # drop non gradable columns -cCat = (dIn['UserName'] == '_Col_Category_') +cCat = dIn["UserName"] == "_Col_Category_" colToDrop = [] for c in dOut.columns: - if c == 'Username': + if c == "Username": continue category = dIn[cCat][c][0] - if category not in ['HomeWork', 'MidTerm', 'FinalExam', 'weighted_column']: + if category not in ["HomeWork", "MidTerm", "FinalExam", "weighted_column"]: colToDrop.append(c) dOut = dOut.drop(colToDrop, axis=1) -dOut.to_csv('BlackBoard.csv', index=False) +dOut.to_csv("BlackBoard.csv", index=False) |