Library Entries Without a Checkout
Problem
You are given two DataFrames:
- `libraryentries` with `entry_id`, `member_id` (one row per visit a member logged)
- `checkouts` with `checkout_id`, `entry_id`, `item_count` (a checkout always links back to an entry)
An entry is "empty" when its `entry_id` never appears in `checkouts` (the member logged a visit but checked nothing out). For each member who has at least one empty entry, count how many empty entries they have.
Return columns `member_id` and `empty_entries`. Members whose every entry has a checkout are omitted.
Input data
Example rows — the live problem includes the full dataset.
| entry_id | member_id |
|---|---|
| 1 | 23 |
| 2 | 9 |
| 4 | 30 |
| 5 | 54 |
| 6 | 96 |
| checkout_id | entry_id | item_count |
|---|---|---|
| 2 | 5 | 2 |
| 3 | 5 | 1 |
| 9 | 5 | 4 |
| 12 | 1 | 1 |
| 13 | 2 | 3 |
Expected output
Your answer should return 3 rows with the columns member_id, empty_entries.
Starter code (Pandas (Python))
import pandas as pd
def library_entries_without_a_checkout(libraryentries, checkouts) -> pd.DataFrame:
# Your code here
return libraryentriesSolve 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