Lumen Interview Question

Python Pandas question to manipulate the data SQL Group by the question