Uninterrupted Study Sessions
Problem
A focus app gives you two DataFrames. `studysession` has columns `session_id`, `user_id`, `start_min`, `end_min` (minute offsets within a day). `ping` has columns `ping_id`, `user_id`, `at_min` (the minute a notification fired).
Report the `session_id` of every study session during which the **same user** received **no** ping. A ping interrupts a session if it fired at any minute from `start_min` to `end_min`, inclusive.
Return a single column `session_id` in any order.
Input data
Example rows — the live problem includes the full dataset.
| session_id | user_id | start_min | end_min |
|---|---|---|---|
| 1 | 1 | 1 | 5 |
| 2 | 1 | 15 | 23 |
| 3 | 2 | 10 | 12 |
| 4 | 2 | 17 | 28 |
| 5 | 12 | 2 | 13 |
| ping_id | user_id | at_min |
|---|---|---|
| 1 | 1 | 5 |
| 2 | 2 | 17 |
| 3 | 12 | 20 |
Expected output
Your answer should return 3 rows with the columns session_id.
Starter code (Pandas (Python))
import pandas as pd
def uninterrupted_study_sessions(studysession, ping) -> pd.DataFrame:
# Your code here
return studysessionSolve this Pandas question free
Write Pandas (Python) and run it instantly in your browser — even on your phone. No signup needed to try.
Solution & explanation
Create a free account to unlock the optimal solution, a step-by-step explanation, and the hidden test cases that grade your answer.
Sign up free to unlock