FunctionRacerProblemsRace

Back the Next Day

MediumpandasPython

visits has columns player and day (a date such as "2026-02-28"), one row per player per day they came. Return the share of all players who came again on the day right after their first day.

Example 1

visits {"player":["ann","ann","bob","bob","cy","dee","dee"],"day":["2026-02-28","2026-03-01","2026-01-05","2026-01-07","2026-01-09","2026-01-31","2026-02-01"]}
returns 0.5

ann (Feb 28, then Mar 1) and dee (Jan 31, then Feb 1) came back the next day. bob and cy did not: 2 of 4.

Constraints

Race itor take your time

Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.

More pandas problems