np.array([(k, np.array(list(g), dtype=grades.dtype).view(np.recarray)[
    'score'].mean()) for k, g in groupby(np.sort(grades, order='student').
    view(np.recarray), itemgetter('student'))], dtype=grades.dtype)
Numpy Mean Structured Array