gradelib.statistics - Summary statistics for computed grades

Functions for summarizing gradebooks.

gradelib.statistics.rank(scores) Series

The rank of each student according to score.

Parameters:

scores (pd.Series) – A series containing overall scores.

Returns:

A Series of the same size as scores containing the integer rank of each student in the class.

Return type:

pd.Series

gradelib.statistics.percentile(scores) Series

The percentile of each student according to score.

Parameters:

scores (pd.Series) – The scores used to compute the percentile.

Returns:

A Series of the same size as scores in which each entry is the student’s percentile in the class, as a number between 0 and 1.

Return type:

pd.Series

gradelib.statistics.average_gpa(letter_grades, include_failing=False)

Compute the average GPA.

Parameters:
  • letter_grades – A Series containing the letter grades.

  • include_failing (Bool) – Whether or not to include failing grades in the calculation. Default: False.

Returns:

The average GPA.

Return type:

float

gradelib.statistics.letter_grade_distribution(letters, valid_letters=('A+', 'A', 'A-', 'B+', 'B', 'B-', 'C+', 'C', 'C-', 'D', 'F'))

Counts the frequency of each letter grade.

Parameters:
  • letters (pd.Series) – The letter grades.

  • valid_letters (Sequence[str]) – The possible letter grades.

Returns:

The count of each letter grade. The letters are guaranteed to be in order, from highest to lowest.

Return type:

pd.Series

gradelib.statistics.lates(gradebook)

A table summarizing the number of late assignments.

gradelib.statistics.outcomes(gradebook: Gradebook)

Compute a table summarizing student outcomes.

Parameters:

gradebook (Gradebook) – The gradebook used to compute outcomes.

Returns:

A table with one row per student, and columns for grades in each assignment group, as well as overall score, letter grade, rank, and percentile. Sorted by score, from highest to lowest.

Return type:

pd.DataFrame