Pandas - Easy Solution
\nimport pandas as pd\n\ndef total_time(employees: pd.DataFrame) -> pd.DataFrame:\n\n    employees[\'total_time\'] = employees[\'out_time\'] - employees[\'in_ti
```\nimport pandas as pd\n\ndef total_time(employees: pd.DataFrame) -> pd.DataFrame:\n\n    employees[\'total_time\'] = employees[\'out_time\'] - employees[\'in_time\']\n    employees = employees.groupby([\'event_day\', \'emp_id\'], as_index=False).agg(sum)\n    employees = employees.rename(columns={\'event_day\': \'day\'})\n    return employees.drop(columns=[\'out_time\', \'in_time\'])\n```
['Pandas']