diff options
-rwxr-xr-x | toBlackboardCSV.py | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/toBlackboardCSV.py b/toBlackboardCSV.py index 7837ea7..019158c 100755 --- a/toBlackboardCSV.py +++ b/toBlackboardCSV.py @@ -10,24 +10,32 @@ 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) -fout = 'BlackBoard.csv' -dOut.to_csv('BlackBoard.csv', index=False) -print(f'Data was exported to {fout}') - +fout = "BlackBoard.csv" +dOut.to_csv("BlackBoard.csv", index=False) +print(f"Data was exported to {fout}") |