Easy pandas solution
\nimport pandas as pd\n\ndef total_time(employees: pd.DataFrame) -> pd.DataFrame:\n    filter_df = employees.groupby([\'emp_id\',\'event_day\'])[[\'in_time\',\'
```\nimport pandas as pd\n\ndef total_time(employees: pd.DataFrame) -> pd.DataFrame:\n    filter_df = employees.groupby([\'emp_id\',\'event_day\'])[[\'in_time\',\'out_time\']].sum().reset_index()\n    filter_df[\'total_time\'] = filter_df[\'out_time\'] - filter_df[\'in_time\']\n    filter_df = filter_df[[\'emp_id\', \'event_day\', \'total_time\']]\n    filter_df.rename(columns = {\'event_day\' : \'day\'}, inplace = True)\n    return filter_df\n```
['Python', 'Python3', 'Pandas']