Pandas, DateOffset, simple filter
Intuition\nCreate additional column representing first activity for each user. Then check how many players have activity in the first + 1 \n\n# Approach\nwith c
# Intuition\nCreate additional column representing first activity for each user. Then check how many players have activity in the first + 1 \n\n# Approach\nwith created \'first\' add to it one day: first + pd.DateOffset(1).It represents potential second day of activity, check how many player have this day in actual events.\n\n# Code\n```\nimport pandas as pd\n\ndef gameplay_analysis(activity: pd.DataFrame) -> pd.DataFrame:\n      activity["first"] = activity.groupby("player_id").event_date.transform(min)\n      activity_2nd_day = activity.loc[activity["first"] + pd.DateOffset(1) == activity["event_date"]]\n      return pd.DataFrame({"fraction":[round(len(activity_2nd_day) / activity.player_id.nunique(),2)]})\n```
['Pandas']