Skip to content

Commit

Permalink
doc avg methode
Browse files Browse the repository at this point in the history
  • Loading branch information
TheLime1 committed Feb 16, 2024
1 parent e8e0707 commit a110dde
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions esprit/grade.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ class Grade:
-------
get_grades():
Returns a list of grades for the student.
calculate_average(grades):
Calculate the average grade based on the given grades.
"""

def __init__(self, session):
Expand Down Expand Up @@ -54,6 +56,17 @@ def get_grades(self):
return grades

def calculate_average(self, grades):
"""
Calculate the average grade based on the given grades.
Parameters
----------
grades (list): A list of lists representing the grades. The first list should contain the column names.
Returns
-------
float: The calculated average grade.
"""
# Convert the list of lists to a DataFrame
df = pd.DataFrame(grades[1:], columns=grades[0])

Expand Down

0 comments on commit a110dde

Please sign in to comment.