当前位置: 首页>>代码示例>>Python>>正文


Python Gradebook.close方法代码示例

本文整理汇总了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()

开发者ID:ellisonbg,项目名称:nbgrader,代码行数:31,代码来源:extract_grades.py


注:本文中的nbgrader.api.Gradebook.close方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。