easy, clean pandas solution
Intuition\neasy, clean pandas solution\n\n# Approach\ngroupby the data by combination of \'actor_id\' and \'director_id\' and count their occurance.\nnext, take
# Intuition\neasy, clean pandas solution\n\n# Approach\ngroupby the data by combination of \'actor_id\' and \'director_id\' and count their occurance.\nnext, take the ones that happen at least three times and show the \'actor_id\' and \'director_id\'\n\n# Complexity\n- Time complexity:\nnot sure\n\n- Space complexity:\nnot sure\n\n# Code\n```\nimport pandas as pd\n\ndef actors_and_directors(actor_director: pd.DataFrame) -> pd.DataFrame:\n    return (\n        actor_director\n        .groupby(by=[\'actor_id\', \'director_id\'], as_index=False)\n        .agg({\'timestamp\': \'count\'})\n        .query(\'timestamp >= 3\')\n        [[\'actor_id\', \'director_id\']]\n    )\n```
['Pandas']