LearnPy Hub
← Pandas: DataFrames problems
Medium

Average CGPA per Department

Print each department (alphabetical) with its average cgpa to 2 decimals, using groupby('dept')['cgpa'].mean().

Input

Lines 'name dept cgpa credits', then END.

Output

Lines.

Sample 1

Input
Mim CSE 3.82 120
Rafi EEE 3.41 98
Sara CSE 3.95 132
Tuhin BBA 3.60 110
Nadia CSE 3.71 125
END
Output
BBA 3.60
CSE 3.83
EEE 3.41

Sample 2

Input
A CSE 3.00 100
END
Output
CSE 3.00
solution.py
Output appears here
Average CGPA per Department · Python practice problem · LearnPy Hub