From d1892ef5c9a08049a3be73e0e9903c605bfedcd9 Mon Sep 17 00:00:00 2001 From: "Eugeniy E. Mikhailov" Date: Wed, 25 Sep 2024 11:58:55 -0400 Subject: python reformated --- toBlackboardCSV.py | 28 ++++++++++++++++++---------- 1 file 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}") -- cgit v1.2.3