Hey there, thanks for sharing your question and the error details! It seems likely that your KeyError is because the column ‘student’ does not exist in your DataFrame ddg2 after the groupby/reset_index operation. Instead, your columns are probably named ‘STDID’, ‘STD_NAME’, and the result of .count() on your grouped columns (like ‘C-1’, ‘C-2’, ‘C-3’), but not ‘student’.