Obligatory warning - new to Python and Pandas.
I'm having some difficulty executing a for loop that only returns the last value in the list.
I have a .csv file containing information that I'd like to run through CanvasAPI to post user scores. The .csv layout is:
Name user_id Score
0 Name_0 7454 90.0
1 Name_1 7075 96.0
2 Name_2 7377 76.0
3 Name_3 7259 49.0
4 Name_4 7294 48.0
5 Name_5 7491 76.5
My code for executing the loop is:
canvas = Canvas(API_URL, API_KEY)
course = canvas.get_course(9997)
assignment = course.get_assignment(78290)
userlist = [canvas.get_user(user) for user in df['user_id']]
length1 = len(userlist)
for i in range(length1):
(userlist[i])
scorelist = df['Score']
length2 = len(scorelist)
for x in range(length2):
(scorelist[x])
submission = assignment.get_submission(userlist[i])
submission.edit(submission={'posted_grade': scorelist[x]})
The loops successfully runs, but only the final row of the .csv is actually scored (for Name_5). What am I missing? Any help greatly appreciated.