本文整理汇总了Python中nbgrader.api.Gradebook.close方法的典型用法代码示例。如果您正苦于以下问题:Python Gradebook.close方法的具体用法?Python Gradebook.close怎么用?Python Gradebook.close使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nbgrader.api.Gradebook
的用法示例。
在下文中一共展示了Gradebook.close方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: open
# 需要导入模块: from nbgrader.api import Gradebook [as 别名]
# 或者: from nbgrader.api.Gradebook import close [as 别名]
# Create a dictionary that will store information about this student's
# submitted assignment
score = {}
score['max_score'] = assignment.max_score
score['student'] = student.id
score['assignment'] = assignment.name
# Try to find the submission in the database. If it doesn't exist, the
# `MissingEntry` exception will be raised, which means the student
# didn't submit anything, so we assign them a score of zero.
try:
submission = gb.find_submission(assignment.name, student.id)
except MissingEntry:
score['score'] = 0.0
else:
score['score'] = submission.score
grades.append(score)
# Create a pandas dataframe with our grade information, and save it to disk
grades = pd.DataFrame(grades).set_index(['student', 'assignment']).sortlevel()
grades.to_csv('grades.csv')
# Print out what the grades look like
with open('grades.csv', 'r') as fh:
print(fh.read())
# Close the connection to the database
gb.close()