Project 1 of 12, for Yahya
NumPy Grade Book
A grade book for a whole class, in one NumPy array: averages, a curve, z-scores, dropped marks and grade bands, without a loop. On real marks from two schools in Portugal.
Act 5 needs a free account, so your work is saved as you go. Act 1 is open to everyone.
The brief
- YahyaPaul asked me how the class's marks are spread, and he wants it done properly rather than by eye.
- YahyaOurs are private, though, so I'm practising on some real marks that aren't.
- YahyaTwo schools in Portugal published theirs, which is three hundred and ninety-five students with three marks each.
- PaulTreat it as one block of numbers and don't do anything one student at a time.
marks.csv is real data: the maths marks of 395 students at two secondary schools in Portugal, published by Paulo Cortez and Alice Silva in 2008. One row per student: an anonymous number, the school, and three marks out of 20, the first period, the second period and the final. load_marks is written. It gives back students, the 395 numbers, and marks, an array of 395 rows and 3 columns.
Write six functions. None of them needs a loop.
student_means(marks): each student's average, one number per student.assessment_means(marks): each assessment's average, one number per column.curve(marks, target): add to every mark in an assessment the amount that would bring that assessment's average totarget, then keep every mark between 0 and 20. Leavemarksas it was.z_scores(marks): how many standard deviations each mark is above or below its assessment's average, as an array the same shape asmarks.dropped(marks, by):Truefor each student whose final (the last column) is at leastbymarks below their first (column 0),Falsefor everyone else.bands(final): the band of each final mark, as an array of letters:Afrom 16,Bfrom 14,Cfrom 12,Dfrom 10,Fbelow 10.
The report at the bottom of the file is written too. It uses your functions.
395 students, 3 assessments Average by assessment: [10.9 10.7 10.4] Best average: student 48, 19.3 After a curve to 12: [12. 12. 12.] Finals more than two deviations below average: 38 Dropped 3 marks or more, first to final: 47 Final bands: A 40, B 60, C 62, D 103, F 130
What you learn
What's in it
- A block of numbers
- Twice the marks
- Rows and columns
- Row first
- The axis that disappears
- Coldest each day
- No loop needed
- A whole class in one block
- Stretching to fit
- Odd shapes
- How Paul would do it
- Fix Aaesha's version
- Make the grade book
- Ship it