Average score per student per subject, with gaps filled

Data framesHard12 min

Your task

Given marks with columns student, subject and score, build a table of the MEAN score for every student and subject pair, using 0 where a pair is missing. Return student, math and science, sorted by student ascending.

Examples

mean_grid(marks: dataframe) -> dataframe
Example 1
Inputmean_grid(marks)
marks
studentsubjectscore
anamath88
anascience92
benmath75
benscience64
caramath95
carascience81
anamath100
Output
studentmathscience
ana9492
ben7564
cara9581