Pandas - Easy Solution
Code\npython\nimport pandas as pd\n\ndef total_time(employees: pd.DataFrame) -> pd.DataFrame:\n    return employees \\\n        .groupby([\'event_day\', \'emp_i
# Code\n```python\nimport pandas as pd\n\ndef total_time(employees: pd.DataFrame) -> pd.DataFrame:\n    return employees \\\n        .groupby([\'event_day\', \'emp_id\']) \\\n        .apply(lambda x: sum(x[\'out_time\'] - x[\'in_time\'])) \\\n        .reset_index() \\\n        .rename(columns={\n            0: \'total_time\',\n            \'event_day\': \'day\'\n        })\n\n```
['Pandas']