Example usage¶
To use gradecalculatorpy
in a project:
import gradecalculatorpy
print(gradecalculatorpy.__version__)
1.0.1
Imports¶
from gradecalculatorpy.construct_course import construct_course
from gradecalculatorpy.update_grades import update_assignment_grade
from gradecalculatorpy.calculate_grade import calculate_grade
from gradecalculatorpy.predict_final import predict_final
import pandas as pd
1. Create the grading structure of a course using construct_course
¶
construct_course('dsci524', '/')
---------------------------------------------------------------------------
StdinNotImplementedError Traceback (most recent call last)
Cell In[4], line 1
----> 1 construct_course('dsci524', '/')
File ~/checkouts/readthedocs.org/user_builds/gradecalculatorpy/envs/latest/lib/python3.9/site-packages/gradecalculatorpy/construct_course.py:44, in construct_course(course_name, output_file_path)
41 while course_total_weight < 100:
42 curr_component = []
---> 44 curr_component_name = input(f"What is name of {course_name} component #{index+1}? ")
46 # Check if the weight input can be parsed as integer
47 curr_component_weight_input = input(f"What is weight(%) of {course_name} component #{index+1}? ")
File ~/checkouts/readthedocs.org/user_builds/gradecalculatorpy/envs/latest/lib/python3.9/site-packages/ipykernel/kernelbase.py:1186, in Kernel.raw_input(self, prompt)
1184 if not self._allow_stdin:
1185 msg = "raw_input was called, but this frontend does not support input requests."
-> 1186 raise StdinNotImplementedError(msg)
1187 return self._input_request(
1188 str(prompt),
1189 self._parent_ident["shell"],
1190 self.get_parent("shell"),
1191 password=False,
1192 )
StdinNotImplementedError: raw_input was called, but this frontend does not support input requests.
pd.read_csv('dsci524.csv', index_col=0)
Components | Weights (%) | Grades (%) | |
---|---|---|---|
0 | Milestone 1 | 20 | NaN |
1 | IA 1 | 2 | NaN |
2 | Milestone 2 | 20 | NaN |
3 | IA 2 | 3 | NaN |
4 | Milestone 3 | 20 | NaN |
5 | Milestone 4 | 20 | NaN |
6 | Individual peer review | 10 | NaN |
7 | Team work reflection | 5 | NaN |
2. Update a few components using update_grades
¶
update_assignment_grade('dsci524.csv', 'Milestone 1', 95.12)
pd.read_csv('dsci524.csv', index_col=0)
Components | Weights (%) | Grades (%) | |
---|---|---|---|
0 | Milestone 1 | 20 | 95.12 |
1 | IA 1 | 2 | NaN |
2 | Milestone 2 | 20 | NaN |
3 | IA 2 | 3 | NaN |
4 | Milestone 3 | 20 | NaN |
5 | Milestone 4 | 20 | NaN |
6 | Individual peer review | 10 | NaN |
7 | Team work reflection | 5 | NaN |
update_assignment_grade('dsci524.csv', 'IA 1', 99.99)
update_assignment_grade('dsci524.csv', 'Milestone 2', 90.33)
update_assignment_grade('dsci524.csv', 'IA 2', 99.99)
update_assignment_grade('dsci524.csv', 'Milestone 3', 92.55)
update_assignment_grade('dsci524.csv', 'Milestone 4', 95.75)
update_assignment_grade('dsci524.csv', 'Individual peer review', 93.33)
pd.read_csv('dsci524.csv', index_col=0)
Components | Weights (%) | Grades (%) | |
---|---|---|---|
0 | Milestone 1 | 20 | 95.12 |
1 | IA 1 | 2 | 99.99 |
2 | Milestone 2 | 20 | 90.33 |
3 | IA 2 | 3 | 99.99 |
4 | Milestone 3 | 20 | 92.55 |
5 | Milestone 4 | 20 | 95.75 |
6 | Individual peer review | 10 | 93.33 |
7 | Team work reflection | 5 | NaN |
3. Calculate the grade for last component needed for a target grade using predict_final
¶
predict_final('/dsci524.csv', 93)
78.4
4. Calculate the course’s final average using calculate_grade
¶
update_assignment_grade('dsci524.csv', 'Team work reflection', 80.23)
calculate_grade('dsci524.csv')
Components Weights (%) Grades (%)
0 Milestone 1 20 95.12
1 IA 1 2 99.99
2 Milestone 2 20 90.33
3 IA 2 3 99.99
4 Milestone 3 20 92.55
5 Milestone 4 20 95.75
6 Individual peer review 10 93.33
7 Team work reflection 5 80.23
'Course grade is 93.09%'