🔥 Pandas Simple Solution | Beginners Friendly 🌟
\uD83D\uDD3C IF YOU FIND THIS POST HELPFUL PLEASE UPVOTE \uD83D\uDC4D\n\nimport pandas as pd\n\ndef total_time(employees: pd.DataFrame) -> pd.DataFrame:\n    \n
**\uD83D\uDD3C IF YOU FIND THIS POST HELPFUL PLEASE UPVOTE \uD83D\uDC4D**\n```\nimport pandas as pd\n\ndef total_time(employees: pd.DataFrame) -> pd.DataFrame:\n    \n    employees[\'time_spent\'] = employees[\'out_time\'] - employees[\'in_time\']\n    \n    result_df = employees.groupby([\'emp_id\', \'event_day\'])[\'time_spent\'].sum().reset_index()\n    \n    result_df.rename(columns={\'event_day\': \'day\', \'time_spent\': \'total_time\'}, inplace=True)\n    \n    return result_df\n```\n**\uD83D\uDD3C IF YOU FIND THIS POST HELPFUL PLEASE UPVOTE \uD83D\uDC4D**
['Python', 'Python3']